Use this when
- Writing tests for new or existing code
- Deciding what to test and how
- Setting up the tester agent's review criteria
- Reviewing test quality
Testing Pyramid
Unit Tests (Most)
- Test individual functions and methods
- Fast, isolated, no external dependencies
- One assertion per concept
- Cover: happy path, edge cases, error cases
Integration Tests (Some)
- Test component interactions
- Database queries, API calls, middleware chains
- Use test databases or in-memory alternatives
- Verify data flows correctly between components
End-to-End Tests (Few)
- Test complete user workflows
- Only for critical paths (login, checkout, signup)
- Slower and more brittle; keep count low
Best Practices
Naming
describe("functionName", () => {
it("returns expected value when given valid input", () => {})
it("throws when input is missing", () => {})
it("handles empty array gracefully", () => {})
})
Structure (Arrange-Act-Assert)
// Arrange: set up test data
const input = { name: "test", value: 42 }
// Act: call the function
const result = process(input)
// Assert: verify the outcome
expect(result.status).toBe("success")
What to Test
- Return values for different inputs
- Side effects (database writes, API calls)
- Error conditions and edge cases
- Boundary values (0, -1, MAX_INT, empty string, null)
- State transitions
What NOT to Test
- Implementation details (private methods, internal state)
- Framework code (React rendering, Express routing)
- Simple getters/setters with no logic
- Third-party library behavior
Edge Cases Checklist
- Null / undefined inputs
- Empty strings and arrays
- Very large inputs
- Unicode and special characters
- Concurrent access
- Network timeouts
- Disk full / permission denied
- Invalid date formats
- Negative numbers where positive expected
- Boundary values (0, 1, max-1, max)
Quick checklist
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: testing-patterns-53description: Use this when writing tests, setting up test infrastructure, or deciding on testing strategies for the LOBSTER tester agent4---56## Use this when78- Writing tests for new or existing code9- Deciding what to test and how10- Setting up the tester agent's review criteria11- Reviewing test quality1213## Testing Pyramid1415### Unit Tests (Most)16- Test individual functions and methods17- Fast, isolated, no external dependencies18- One assertion per concept19- Cover: happy path, edge cases, error cases2021### Integration Tests (Some)22- Test component interactions23- Database queries, API calls, middleware chains24- Use test databases or in-memory alternatives25- Verify data flows correctly between components2627### End-to-End Tests (Few)28- Test complete user workflows29- Only for critical paths (login, checkout, signup)30- Slower and more brittle; keep count low3132## Best Practices3334### Naming35```36describe("functionName", () => {37 it("returns expected value when given valid input", () => {})38 it("throws when input is missing", () => {})39 it("handles empty array gracefully", () => {})40})41```4243### Structure (Arrange-Act-Assert)44```typescript45// Arrange: set up test data46const input = { name: "test", value: 42 }4748// Act: call the function49const result = process(input)5051// Assert: verify the outcome52expect(result.status).toBe("success")53```5455### What to Test56- Return values for different inputs57- Side effects (database writes, API calls)58- Error conditions and edge cases59- Boundary values (0, -1, MAX_INT, empty string, null)60- State transitions6162### What NOT to Test63- Implementation details (private methods, internal state)64- Framework code (React rendering, Express routing)65- Simple getters/setters with no logic66- Third-party library behavior6768## Edge Cases Checklist6970- Null / undefined inputs71- Empty strings and arrays72- Very large inputs73- Unicode and special characters74- Concurrent access75- Network timeouts76- Disk full / permission denied77- Invalid date formats78- Negative numbers where positive expected79- Boundary values (0, 1, max-1, max)8081## Quick checklist8283- [ ] Tests cover happy path84- [ ] Tests cover error cases85- [ ] Tests cover edge cases (empty, null, boundary)86- [ ] Each test is independent87- [ ] Test names describe expected behavior88- [ ] No testing of implementation details89- [ ] Mocks are minimal and focused90- [ ] Tests run fast (under 5 seconds for unit tests)9192---93> Converted and distributed by [TomeVault](https://tomevault.io/claim/huskysteam) — claim your Tome and manage your conversions.94<!-- tomevault:4.0:skill_md:2026-04-16 -->