tdd
Test-Driven Development
TDD is the red → green loop. Use the guidance relevant to the current change: what a good test is, where it belongs, and which testing mistakes to avoid. Reuse established project conventions.
When exploring the codebase, read CONTEXT.md (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
What a good test is
Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.
See tests.md for examples and mocking.md for mocking guidelines.
Seams: where tests go
A seam is where a module's interface lives (the term is defined in codebase-design): the place where you observe behavior without reaching inside. Tests go through a module's interface, never against its internals. A deep module may also have internal seams used by its own tests; test at one only when the agreed seams include it.