test-unit
Test individual functions and methods in isolation. Test happy path, edge cases, and error handling. Use when adding new functions, after bug fixes, or before commits.
Install
npx skills add https://github.com/dhaupin/vant/tree/main/models/public/vant/skills/vant-skill-test-unit
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dhaupin-vant@llmmart
git clone https://github.com/dhaupin/vant.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dhaupin/vant collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Unit Test
Test individual functions.
When To Use
- New function
- After bug fix
- Before commit
What To Test
1. Happy Path
test('add works', () => {
expect(add(1, 2)).toBe(3)
})
2. Edge Cases
test('add handles null', () => {
expect(add(null, 2)).toBe(2)
})
test('add handles string', () => {
expect(add('1', 2)).toBe(3)
})
3. Errors
test('add throws on invalid', () => {
expect(() => add()).toThrow()
})
Patterns
| Test | For |
|---|---|
| toBe | Exact value |
| toEqual | Structure |
| toThrow | Errors |
| toHaveBeenCalled | Functions |
Output
## Unit Tests
### Passed
- [n] tests
### Failed
- [n] tests
### Coverage
- [n]%
Role: Unit Tester Input: Test file Output: Test results
Test the smallest pieces.
Files (vant)
-
SKILL.md 1.1 KB
--- name: test-unit description: Test individual functions and methods in isolation. Test happy path, edge cases, and error handling. Use when adding new functions, after bug fixes, or before commits. license: MIT metadata: author: vant version: "1.0" --- # Unit Test > Test individual functions. ## When To Use - New function - After bug fix - Before commit --- ## What To Test ### 1. Happy Path ```javascript test('add works', () => { expect(add(1, 2)).toBe(3) }) ``` ### 2. Edge Cases ```javascript test('add handles null', () => { expect(add(null, 2)).toBe(2) }) test('add handles string', () => { expect(add('1', 2)).toBe(3) }) ``` ### 3. Errors ```javascript test('add throws on invalid', () => { expect(() => add()).toThrow() }) ``` --- ## Patterns | Test | For | |------|-----| | toBe | Exact value | | toEqual | Structure | | toThrow | Errors | | toHaveBeenCalled | Functions | --- ## Output ``` ## Unit Tests ### Passed - [n] tests ### Failed - [n] tests ### Coverage - [n]% ``` --- **Role**: Unit Tester **Input**: Test file **Output**: Test results > Test the smallest pieces.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.