Chapter 10: Tests

Tautological test

Also called Assertion-free test

A test that can't fail, because it compares the code with itself, checks nothing, or only checks something that is always true.

These are what an agent produces when asked to "add tests". They look like work, they raise coverage, and the summary says "47 tests pass". One quick check finds the worst of them: make every function return nothing and see what still passes.

Say it to your agent

“Stub every exported function in src/price.ts so it returns undefined, and run the tests. List every test that still passes, then rewrite or delete them. Expected values must be literal numbers and not computed.”

The workshop

Name a word, or describe what you mean in everyday language.