Chapter 10: Tests

Fixture

The known starting state a test sets up before it runs: a sample user, a few rows in a table, a file on disk. Good ones are created fresh for each test.

Agents love to share a fixture between tests because it saves lines. That is how you get a suite that passes in one order and fails in another.

Say it to your agent

“These tests share one users array and they mutate it. Move it into a makeUsers() function, and call that in each test, so that no test can see another test's changes.”

The workshop

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