Use when the Integrator is writing unit tests, e2e tests, designing test strategies, improving test coverage, creating test fixtures, or mocking dependencies. Activates for any testing-related work including TDD, test refactoring, or test debugging.
Apply this guidance when:
Every test should follow this pattern:
test("should calculate total with tax", () => {
// Arrange — Set up test data and dependencies
const cart = createCart([{ price: 100 }, { price: 50 }]);
const taxRate = 0.1;
// Act — Execute the code under test
const total = calculateTotal(cart, taxRate);
// Assert — Verify the result
expect(total).toBe(165);
});
| Test | Example |
|---|---|
| Happy path | Valid input produces expected output |
| Edge cases | Empty input, boundary values, max/min |
| Error cases | Invalid input, missing data, exceptions |
| State transitions | Before/after mutation operations |
Test names should describe the scenario and expected outcome:
should return empty array when no items match filtershould throw ValidationError when email is invalidshould update timestamp after successful saveFeature: User authentication
Scenario: Successful login
Given a registered user with email "[email protected]"
When they submit valid credentials
Then they receive an auth token
And they can access protected resources
| Mock | Don't Mock |
|---|---|
| External APIs and services | The code under test |
| Database in unit tests | Pure functions |
| File system in unit tests | Data transformations |
| Time/randomness | Simple dependencies |
Before committing (via /commit-work), verify: