Workshop index · Download all examples and lessons
Contract: cancellation restores the booking’s seats exactly once. Cancelling an already cancelled booking returns false and does not change availability. A fresh store starts with capacity 10 and a single confirmed booking for 3 seats, so availability starts at 7.
The candidate adds cancellation to a store. The smoke test covers one successful call. Python’s exercise asks you to expose repeated restoration. TypeScript’s exercise additionally includes a test that starts an asynchronous assertion but fails to return or await it.
python3 exercises/05-cancellation/python/smoke.py
node --test exercises/05-cancellation/typescript/smoke.test.ts
node --test exercises/05-cancellation/typescript/misleading.test.ts The last command passes, but inspect whether its assertion ever executes. The unresolved promise deliberately has no timer or I/O handle to keep Node running. This is a test-design exercise, not a pattern to copy.
Write a regression test that fails against the candidate for the intended reason. Then compare your fix with solutions/05-cancellation/.