Fix tests for booking and booking_campsite

This commit is contained in:
jordi fita mas 2024-04-21 21:57:34 +02:00
parent 7eb718dfd9
commit a26e9c6e12
2 changed files with 2 additions and 25 deletions

View File

@ -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 *

View File

@ -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.'
);