From a26e9c6e1201a3fe26fef65fde21df07bb98b9e2 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Sun, 21 Apr 2024 21:57:34 +0200 Subject: [PATCH] Fix tests for booking and booking_campsite --- test/booking.sql | 25 +------------------------ test/booking_campsite.sql | 2 +- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/test/booking.sql b/test/booking.sql index 67eec33..0690632 100644 --- a/test/booking.sql +++ b/test/booking.sql @@ -5,7 +5,7 @@ reset client_min_messages; begin; -select plan(78); +select plan(74); set search_path to camper, public; @@ -257,29 +257,6 @@ select throws_ok( 'Should not be able to add bookings owing dogs to holder.' ); -select throws_ok( - $$ insert into booking (company_id, campsite_type_id, holder_name, stay, number_dogs, acsi_card, booking_status) values (2, 10, 'Holder', daterange('2024-01-18', '2024-01-19'), 0, false, 'confirmed') $$, - '23514', 'new row for relation "booking" violates check constraint "booking_needs_campsite"', - 'Should not be able to confirm bookings without a campsite.' -); - -select throws_ok( - $$ insert into booking (company_id, campsite_type_id, holder_name, stay, number_dogs, acsi_card, booking_status) values (2, 10, 'Holder', daterange('2024-01-18', '2024-01-19'), 0, false, 'checked-in') $$, - '23514', 'new row for relation "booking" violates check constraint "booking_needs_campsite"', - 'Should not be able to checke bookings in without a campsite.' -); - -select throws_ok( - $$ insert into booking (company_id, campsite_type_id, holder_name, stay, number_dogs, acsi_card, booking_status) values (2, 10, 'Holder', daterange('2024-01-18', '2024-01-19'), 0, false, 'invoiced') $$, - '23514', 'new row for relation "booking" violates check constraint "booking_needs_campsite"', - 'Should not be able to invoice bookings without a campsite.' -); - -select lives_ok( - $$ insert into booking (company_id, campsite_type_id, holder_name, stay, number_dogs, acsi_card, booking_status) values (2, 10, 'Holder', daterange('2024-01-18', '2024-01-19'), 0, false, 'cancelled') $$, - 'Should be able to cancel bookings even without a campsite.' -); - select * diff --git a/test/booking_campsite.sql b/test/booking_campsite.sql index faa3b61..bd629e7 100644 --- a/test/booking_campsite.sql +++ b/test/booking_campsite.sql @@ -77,7 +77,7 @@ values (18, 12, daterange('2024-01-18', '2024-01-29')) ; select lives_ok( - $$ insert into booking_campsite (booking_id, campsite_id, stay) values (18, 16, daterange('2024-01-19', '2024-01-29')) $$, + $$ insert into booking_campsite (booking_id, campsite_id, stay) values (18, 14, daterange('2024-01-18', '2024-01-29')) $$, 'Can insert a new campsite booking for the same range as another.' );