docs(tests): add tests/README.md with factory and mock catalogs#1006
docs(tests): add tests/README.md with factory and mock catalogs#1006
Conversation
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — This is a thorough, accurate documentation of the test infrastructure. I verified every factory, mock, harness function, and convention claim against the actual source files and vitest config. The documentation faithfully reflects the codebase.
Verification performed
- factories.ts: All 13 documented factory functions match (names, signatures, return types, default values)
- sharedMocks.ts: All 15 documented exports match the source (names, mocked modules, descriptions)
- backendMocks.ts: All 5 documented exports match the source
- trpcTestHarness.ts:
createCallerFor,setupOwnershipCheckMock, andexpectTRPCErrorall match documented signatures and behavior - mockDb.ts:
createMockDboptions (withLimit,withDoubleJoin,withUpsert,withThenable) andcreateMockDbWithGetDbmatch - mockPMProvider.ts: All documented stubbed methods match the source (including default return values for
addComment→''andlinkPR→undefined) - vitest.config.ts: Project structure (4 unit + 1 integration),
clearMocks: true,isolate: falsefor unit-core all confirmed - CLAUDE.md: Pointer line correctly placed under
### Testing
Minor note (not blocking)
mockPersonas.ts is listed in the directory tree (└── mockPersonas.ts — GitHub bot-identity stub helpers) but has no dedicated catalog entry like the other helpers. It exports mockPersonaIdentities, IMPLEMENTER_USERNAME, and REVIEWER_USERNAME. Since it's a small file (14 lines, 3 exports), the tree listing is probably sufficient — but if the goal is a complete catalog, a one-row table under Mock Catalog would round it out.
🕵️ claude-code · claude-opus-4-6 · run details
Summary
tests/README.mddocumenting all shared test helpers, factory functions, mock catalogs, and conventionsCLAUDE.mdunder the Testing section linking to the new READMECard: https://trello.com/c/dC7hK1vw/524-as-a-developer-i-want-a-tests-readmemd-with-factory-and-mock-catalogs-so-that-new-test-contributors-follow-consistent-patterns
What was implemented
tests/README.md(new file)tests/helpers/factories.ts(project, tRPC user/context, trigger context, Trello payload, GitHub payload) with file paths, descriptions, and usage examplessharedMocks.ts(15 exports) andbackendMocks.ts(5 exports), each with the module they mock andvi.mock()usage examplescreateCallerFor,setupOwnershipCheckMock, andexpectTRPCErrorwith full usage examplescreateMockDb(all options) andcreateMockDbWithGetDbwith usage examplescreateMockPMProviderwith all stubbed methods listedvi.mock()hoisting constraint,vi.hoisted()preferred pattern,clearMocks: trueauto-reset behavior, andisolate: falsesafety rules forunit-coreCLAUDE.md(updated)### Testinglinking totests/README.mdTest plan
npm run lintpasses (zero errors)npm run typecheckpasses (zero errors)🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details