docs(adr): ADR-011 TDD foundation; update AGENTS.md per-feature
Captures the decision to add @repo/core-testing, factories, contract suites, vitest safety defaults, coverage thresholds, Storybook test-runner, and CI as one cohesive TDD foundation. Per-feature AGENTS.md gains a Tests section pointing to factories, contract suite, and the canonical test commands. Spec: §7.4, §7.5 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,20 @@ beforeEach(() => {
|
||||
|
||||
Covered areas: sign-in/up/out use cases, user validation, DI container binding.
|
||||
|
||||
## Tests
|
||||
|
||||
- **Factories:** `src/__factories__/user.factory.ts`, `src/__factories__/session.factory.ts` — use `userFactory.build({ overrides })` to construct test data with stable defaults.
|
||||
- **Contract suite:** `src/__contracts__/users-repository.contract.ts` — runs against every repository implementation (mock + payload).
|
||||
- **Unit tests:** colocated as `*.test.ts` next to the source file.
|
||||
- **Feature integration:** `tests/sign-in-flow.feature.test.ts` — full slice through tRPC router → controller → use case → mock repo.
|
||||
|
||||
```bash
|
||||
pnpm test --filter @repo/auth # all tests for this feature
|
||||
pnpm test --filter @repo/auth -- --watch # watch mode
|
||||
```
|
||||
|
||||
See `docs/guides/tdd-workflow.md` for the cycle.
|
||||
|
||||
## Structure (minimal feature)
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user