Mock Castle
detected 2026-03-02
trigger
"21 vi.mock() calls, 65 lines of mock setup, 45 lines of assertions. Testing a 4-line function."
what it is
Mock scaffolding consumes more lines and cognitive load than the actual assertions. The test primarily verifies mock wiring, not product behaviour. A 4:1 mock-to-assertion ratio provides less regression confidence than its line count implies.
how to detect
Count mock declarations vs test assertions per file. If mock setup exceeds 3x assertion code, the test is a castle built on sand.
instead
Extract pure functions into a separate module with no side-effect imports. Test them without mocking the universe.
refs
- wake:tests/unit/bout-engine-helpers.test.ts: 21 vi.mock()
← all patterns