Objective: Walk into a codebase's unit suite — one you didn't write — and read it, judge it, extend it safely. (Status: TestGen's repo module is roadmap P4-2; this is the practice you'll apply to any repo today.)
⏱ ≈53 min full lesson · English edition — Español · العربية · বাংলা in translation
1) FIND THE MAP: test files mirror source files (pricing.ts ↔ pricing.test.ts). Naming is the index. 2) READ ONE FILE COMPLETELY: naming idiom, input builders, and its negative space — what it refuses to check tells you what the team fears. 3) RUN IT and read failures B-06 style: shape first.
SLOW (minutes, not seconds) = secretly doing I/O — integration tests in unit clothes. BRITTLE = asserting IMPLEMENTATION (which helper got called) instead of BEHAVIOR (input → output); breaks when code improves. BOUNDARY-POOR = happy paths only; the suite documents the demo, not the contract.
MOCK-DRUNK = so much is faked that the test proves the mocks agree with each other. SILENT SKIPS = disabled tests with no owner or reason — a skip without a date is a deletion nobody admitted to (A-02's quarantine discipline applies at every layer).
ADD, don't rearrange: first contributions are new tests in the existing idiom, even if you'd design it differently. Consistency is a feature; style crusades fork suites. Start from a BUG or a BOUNDARY — the highest-value first tests there are.
Asked to test a legacy function nobody understands? Write CHARACTERIZATION tests first: pin its CURRENT behavior (even the weird parts, marked as such) BEFORE anyone refactors. The suite becomes the safety net that makes the refactor discussable.
Take any open-source repo you use. Find one source file and its mirrored test. Read ONLY the test names and write the contract they claim. Then read the source and mark behavior the names DON'T claim. That unclaimed list is where your first tests go.
Inside the repo, handled. Final Advanced stop: integrations — where cases live and results go.