Answer prose round 1: 0 🔴, 1 🟡 (0 misread); name the payroll run and the precondition in the example

This commit is contained in:
2026-11-18 17:21:41 +01:00
parent eb49d62e36
commit e5751153a5
+1 -1
View File
@@ -46,7 +46,7 @@
- Assert the outcome — returned values, stored state, emitted output — not how the code reached it. Use real collaborators or fakes; mock only slow, nondeterministic or external edges. BANNED: asserting which internal function ran, or scanning the source with `ast` or a regex. GOOD: `assertEqual(saved_row, {...})` against a fake store; a fake clock.
- Pin wording only where the wording is the contract: a message a consumer parses, a published format. For prompts, help and error text, assert the facts the text must carry — an item ID, a model argument, an error code — not the sentence. BANNED: `assertIn("<a 600-character prompt sentence>", prompt)`. GOOD: `assertIn("model opus, effort high", prompt)`.
- One behaviour per test, named for it, tested once, at the lowest level that reproduces it. No loops or branches in a test body; parametrize the cases.
- A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))`, since a broken payroll also creates zero rows. GOOD: check the precondition before the action, failing with its cause, then `expect(created).toEqual([1, 2, 1])`.
- A test doesn't decide at run time whether to check anything: no conditional skip, early return, or catch around its assertions. A test that needs a state creates it, or fails and names what is missing. BANNED: `test.skip(created.every((count) => count === 0))` after the payroll run under test, since a broken payroll also creates zero rows. GOOD: before running the payroll, check each precondition and fail naming the one that is missing; after it, `expect(created).toEqual([1, 2, 1])`.
- Every escaped bug becomes a test that fails without its fix.
- Write no test that no real bug could fail: a constant's value, a list's length, the framework's own behaviour.
- A test neither sleeps nor asserts on the wall clock, and seeds any randomness.