Change how you think about tests
Most people learn tests as a chore: extra code you write to prove your real code works, for
somebody else’s benefit.
With agents, that is the wrong picture. Here is the right one:
Tests are how the agent sees.
Without tests it makes a change, cannot check it, and tells you it is done. With tests it
makes a change, runs them, sees red, and tries again — without you.
This is Lesson 3.2’s fourth beat. Check is the beat that does all the work, and tests
are usually what makes it possible.
The economics changed
Writing tests used to be slow. That was the honest argument against them on small projects.
Now the agent writes them in seconds. The cost dropped hard.
At the same time the value went up, because now something other than you uses them, all day,
without getting bored.
Cheaper and more valuable. That is an unusual combination and it is worth acting on.
But remember Lesson 4.4
You saw what happens when the agent writes both the code and the tests: they can be wrong
together, and green means nothing.
So split the job:
You supply the cases. The agent supplies the plumbing.
You say what the right answers are. It writes the code that checks them. That way the tests
come from a different source than the code, which is the only reason tests catch anything.
What good cases look like
Take them from your plan, not from your code. Your plan in Lesson 2.5 already listed the
important ones:
- The ordinary case. A gap of 10, answered hard, gives 12.
- The boundary. A gap of 200 answered easy stops at 365.
- The awkward one. A gap of 1 answered easy gives 2, not 3.
- The empty case. No cards due shows the message.
- The one you nearly forgot. An overdue card still appears.
That last one is the entire reason you caught the <= bug.
Make one command run everything
npm test
That single command should run every check you have. If a check needs a special command that
only you know, the agent will not run it, and it might as well not exist.
Try this before the next lesson
- Count the tests in Recall. Which came from your plan and which did the agent invent?
- Find one rule in your plan that has no test. Add a case for it.
- Delete a line of working code on purpose. Does
npm testgo red? If not, that code is
unprotected.