Testing patterns
Skill subhansh-dev/agent-maxxing/engineering/testing-patterns
Testing methodology — what to test, how to test it, test structure, and common patterns.From its SKILL.md
npx -y skills add subhansh-dev/agent-maxxing --skill testing-patternsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.0 KB, 480 tokens by cl100k_base, as published. Nobody here has run it
Testing Patterns
What to Test
Always Test
- Happy path (the main use case)
- Edge cases (null, empty, 0, negative, max values)
- Error paths (what happens when things fail)
- Integration points (API calls, database, file I/O)
Don't Bother Testing
- Simple getters/setters
- Framework code you don't own
- Implementation details (test behavior, not implementation)
- Trivial utilities with no logic
Test Structure
describe('UserService', () => {
describe('createUser', () => {
it('creates a user with valid data', () => { ... })
it('rejects duplicate emails', () => { ... })
it('hashes the password', () => { ... })
it('returns user without password field', () => { ... })
})
})
Pattern: describe the unit, it describes the behavior in plain English.
Test Pyramid
/ E2E \ ← Few, slow, high confidence
/ Integration \ ← Some, medium speed
/ Unit Tests \ ← Many, fast, focused
- Unit tests: 70% — test individual functions
- Integration tests: 25% — test modules working together
- E2E tests: 5% — test the full user journey
Common Patterns
Arrange-Act-Assert
// Arrange: set up the test data
const user = { name: 'Test', email: '[email protected]' }
// Act: call the function
const result = createUser(user)
// Assert: check the result
expect(result).toHaveProperty('id')
expect(result.email).toBe('[email protected]')
Mock External Dependencies
jest.mock('./database', () => ({
query: jest.fn().mockResolvedValue([{ id: 1 }])
}))
Test Error Cases
it('throws on invalid input', () => {
expect(() => parseConfig(null)).toThrow('Config is required')
})
Coverage
- Aim for 80%+ line coverage
- But coverage ≠ quality — 100% coverage with no edge case tests is worthless
- Focus on covering the paths that matter most
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.