Loading video player…

Intent and Acceptance: Knowing What "Correct" Means (Overview)

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:

Language: Text
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:

  1. 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.
  2. Reading the Tests You Inherit: Read the tests your teammate Edsger wrote.
  3. Writing Tests From Criteria: Write tests of your own, and see each one fail first.
  4. 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.

Download

Course Slides (.pdf)

331.5 KB
Download

Sample Code (.zip)

4.3 KB

00:00 Welcome to Intent and Acceptance: Knowing What Correct Means. You’ll say what a change must do before judging it.

00:09 Here’s a first taste: one rule for gift cards, in pence. A 1000 pence gift card pays for Small Maps and keeps 250. Its test fails on today’s code, which has no gift cards yet.

00:23 On a gift card branch, it passes: one rule checked.

00:29 You’re on the tech team at The Second Draft. Grace, the owner, wants gift cards customers spend over several visits. Quill, the team’s AI agent, opened a pull request, and all 19 tests pass.

00:43 Can you put your name on it? Passing tests can’t tell you until someone says what Grace wants.

00:51 By the end, you’ll turn a request into an intent, checkable criteria, and tests that fail when it’s wrong, and judge a change with them. You’ll start from Grace’s student discount, read your teammate Edsger’s tests, and write your own, each failing first.

01:08 In the project, you’ll check Quill’s gift cards and report to Edsger.

01:14 It’s the path’s first course to assume Intermediate JavaScript. It teaches the testing it needs. Bring your map of the shop, Node 26 and Git. The shop’s code is your clone from GitHub, so there’s nothing to download.

01:30 New here? The first lesson gets you the code and starts your map. Most lessons are text, and two more are videos like this one. Tests check the exercises, and a quiz ends the course.

01:43 At the bottom of the page are the slides and sample code, the lessons’ checks and tests to compare with yours.

01:51 Next up: Write the Intent Before the Code.

Become a Member to join the conversation.