Appointment Booking API · Step 6 of 7
Add cancellation and scenario checks
Implement booking lookup and cancellation with a documented state transition. Cover missing IDs, repeat cancellation, and cancellation after the allowed window.
Understand
Lifecycle transitions should be explicit so cancelled records do not silently become active again.
Build
Use a test database or isolated fixtures to exercise successful and rejected requests. Keep test data separate from real data.
Check
The API handles success, invalid input, not found, conflict, and repeat cancellation predictably.
Try it
Add one test for a boundary time such as exactly the cancellation cutoff.
