Step 6: Frontend unit tests - requires GATE 5 passed
Write comprehensive frontend unit tests for completed components, covering all states, interactions, and accessibility requirements. Use only after frontend implementation passes Gate 5.
/plugin marketplace add packlikez/claude-code-dev-plugin/plugin install dev@packlikez-dev-plugins<feature-name>□ GATE 5 PASSED (frontend implementation complete)
□ All components implemented
□ Build passes
cat specs/{type}/{feature-name}.md # Spec
cat api-contracts/{feature}.yaml # API contract
cat src/components/{feature}/*.tsx # Components
cat src/hooks/use{Feature}.ts # Hooks
cat skills/test-patterns-unit.md # Unit test patterns
cat skills/gate-6-frontend-unit.md # Gate 6 criteria
## Test Checklist
### Component Tests
- [ ] Default render
- [ ] Props variations
- [ ] Loading state
- [ ] Error state
- [ ] Empty state
### Hook Tests
- [ ] Initial state
- [ ] Success state
- [ ] Error state
### Interaction Tests
- [ ] Form submission (exact callback args)
- [ ] Button clicks
- [ ] Validation errors
Use Task tool with test-writer agent:
Write frontend unit tests for {feature-name}:
- Every component state (loading, error, empty, success)
- Every hook state
- User interactions with exact assertions
- Accessibility (keyboard, axe audit)
- Follow test-patterns-unit skill
From test-patterns-unit skill:
From spec:
// Required for every component
it('should pass axe audit', async () => {
const { container } = render(<Component />);
expect(await axe(container)).toHaveNoViolations();
});
it('should be keyboard navigable', async () => {
await userEvent.tab();
expect(screen.getByLabelText('Email')).toHaveFocus();
});
Use Task tool with gate-keeper agent:
Validate GATE 6 for {feature-name}
See gate-6-frontend-unit skill for all 24 criteria.
tests/unit/components/{feature}/tests/unit/hooks/