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:
2026-05-05 19:31:31 +02:00
parent 17d3488fb4
commit 5ea4c67f93
7 changed files with 141 additions and 2 deletions

View File

@@ -69,6 +69,20 @@ beforeEach(() => {
- **Alias** — `@/` resolves to `src/`
- **Run** — `pnpm test --filter @repo/navigation`
## Tests
- **Factories:** `src/__factories__/header.factory.ts` — use `headerFactory.build({ overrides })` to construct test data with stable defaults.
- **Contract suite:** `src/__contracts__/navigation-repository.contract.ts` — runs against every repository implementation (mock + payload).
- **Unit tests:** colocated as `*.test.ts` next to the source file.
- **Feature integration:** `tests/get-header.feature.test.ts` — full slice through tRPC router → controller → use case → mock repo.
```bash
pnpm test --filter @repo/navigation # all tests for this feature
pnpm test --filter @repo/navigation -- --watch # watch mode
```
See `docs/guides/tdd-workflow.md` for the cycle.
## Structure (minimal)
Per spec addendum v5 ("create folders only when needed"), this feature is small: