📅 prove a settled booking goes with its slot
Browse files at this commit04b3469a216c2f4c6f7473dcdbc0f274106cbf41Parent: 2202807- test
- 📅 prove a settled booking goes with its slot
1 changed file +10 -0
- tests/integration.rs +10 -0
tests/integration.rsmodified+10 -0
| @@ -17472,6 +17472,16 @@ async fn slot_delete_waits_for_the_booking_to_settle() { | |||
| 17472 | ); | 17472 | ); |
| 17473 | let res = send(&app, "DELETE", &uri, Some(&ali), None).await; | 17473 | let res = send(&app, "DELETE", &uri, Some(&ali), None).await; |
| 17474 | assert_eq!(res.status, StatusCode::NO_CONTENT, "{}", res.body); | 17474 | assert_eq!(res.status, StatusCode::NO_CONTENT, "{}", res.body); |
| 17475 | + // The settled booking goes with the slot, in the same transaction — it is | ||
| 17476 | + // history of a meeting that no longer exists, and a row left pointing at a | ||
| 17477 | + // deleted slot is a dangling link every read of it has to survive. The | ||
| 17478 | + // `204` alone never proved the cascade ran, so the count is read from the | ||
| 17479 | + // database (`pay_row_count` is this file's plain table count). | ||
| 17480 | + assert_eq!( | ||
| 17481 | + pay_row_count(&db, "appointment").await, | ||
| 17482 | + 0, | ||
| 17483 | + "the cancelled booking {booking} outlived its slot" | ||
| 17484 | + ); | ||
| 17475 | assert_eq!( | 17485 | assert_eq!( |
| 17476 | send(&app, "DELETE", &uri, Some(&ali), None).await.status, | 17486 | send(&app, "DELETE", &uri, Some(&ali), None).await.status, |
| 17477 | StatusCode::NOT_FOUND | 17487 | StatusCode::NOT_FOUND |