The introduction of `Test::NoWarnings` (bug 38944) allowed us to detect these tests do not cover all the behavior: when the database makes `Can*BeReserved` not return `status => OK` the tests pass (because the endpoint is designed to place the hold regardless, but a warning is printed in the logs. This behavior is not tested. The tests should: * Cover the item-level holds case * Not depend on existing data/circulation rules on the DB * Tests this `warn` behavior correctly
Created attachment 182177 [details] [review] Bug 39869: Add more tests for the club holds endpoint This patch does: * Mock `CanItemBeReserved` and `CanBookBeReserved` to better control the test scenario and make it agnostic from existing data. * Adds tests for the item-level group holds use case * Adds tests for the warnings printed when placing the hold should not be possible To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/clubs_holds.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>