You’re on the small tech team at The Second Draft, an independent bookshop. Grace, the owner, wants gift cards: “Customers buy one, and spend it over several visits.” Quill, the team’s AI coding agent, has already opened pull request #31 on the branch quill/gift-cards, and all 19 of the shop’s tests pass on it. Can you put your name on it? Passing tests can’t tell you until someone says what Grace wants.
In this course, you’ll say what a change must do before you judge it. For a first taste, here’s one rule for gift cards, written in pence as a criterion:
Given GIFT-1000 (1000p)
when one Small Maps (750p) is ordered with it
then 0p goes on the customer's ordinary (bank) card, and GIFT-1000 keeps 250p
A test written from that criterion fails on the shop’s code today, which has no gift cards yet. On Quill’s gift card branch, the same test passes, and that’s one rule checked.
What You’ll Learn
By the end of this course, you’ll turn a request into a written intent, checkable acceptance criteria, and tests that fail when the code is wrong. Then you’ll use them to judge whether a change does what was asked. The course follows that route in order:
- Saying What Correct Means: Start from Grace’s idea for a student discount, and turn it into an intent and criteria someone else can check.
- Reading the Tests You Inherit: Read the tests your teammate Edsger wrote.
- Writing Tests From Criteria: Write tests of your own, and see each one fail first.
- Project: Grace’s Gift Cards: Check Quill’s gift cards with your own intent, criteria and tests, and report what you find to Edsger.
What You Should Know Already
This is the third course on the Judging and Verifying Code You Didn’t Write path, and the first that assumes Intermediate JavaScript: modules, nested data, higher-order functions, classes, and custom errors. You don’t need to have written tests before. The course teaches the testing it needs.
From the first two courses, bring your map.md of the shop, with its modules, data flow and invariants. The shop’s code is your clone of The Second Draft’s GitHub repository, realjs/second-draft-books, which you made in the first course, so there’s nothing to download for it. If you’re starting here instead, the first lesson gets you the code and starts your map. You’ll need Node 26 and Git installed.
How the Course Works
Most lessons are text, and two more are videos like this one. Coding exercises run in your browser, and the course’s own tests check them. A quiz comes at the end.
At the bottom of the page are the slides (PDF) and the sample code (ZIP), which has the lessons’ checks and tests to compare with yours.
Next up is Write the Intent Before the Code.