From f25f881751a9ef4e55caa891f9549502a095dcdd Mon Sep 17 00:00:00 2001 From: Nick Evans <2616208+nickevansuk@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:29:33 +0100 Subject: [PATCH 1/2] feat: Add `validThroughBeforeStartDate` (#604) --- .../built-types/criteria/criteriaUtils.d.ts | 12 ++++++-- .../src/criteria/TestOpportunityBookable.js | 4 +-- ...estOpportunityBookableAdditionalDetails.js | 4 +-- .../TestOpportunityBookableAttendeeDetails.js | 4 +-- .../criteria/TestOpportunityBookableInPast.js | 4 +-- .../TestOpportunityBookableNoSpaces.js | 4 +-- ...ityBookableNonFreePrepaymentUnavailable.js | 4 +-- .../TestOpportunityBookableOneSpace.js | 4 +-- ...BookableOutsideValidFromBeforeStartDate.js | 12 ++++---- ...yBookableWithinValidFromBeforeStartDate.js | 17 ++++++++--- .../src/criteria/criteriaUtils.js | 30 +++++++++++++++---- 11 files changed, 69 insertions(+), 30 deletions(-) diff --git a/packages/test-interface-criteria/built-types/criteria/criteriaUtils.d.ts b/packages/test-interface-criteria/built-types/criteria/criteriaUtils.d.ts index 3df8bb4b6d..59d04f4d99 100644 --- a/packages/test-interface-criteria/built-types/criteria/criteriaUtils.d.ts +++ b/packages/test-interface-criteria/built-types/criteria/criteriaUtils.d.ts @@ -63,9 +63,17 @@ export function getRemainingCapacity(opportunity: Opportunity): number | null | * * @param {Offer} offer * @param {Opportunity} opportunity - * @returns {DateTime | null} null if there is no booking window defined. + * @returns {DateTime | null} null if there is no booking window lower limit defined. */ export function getDateAfterWhichBookingsCanBeMade(offer: Offer, opportunity: Opportunity): any | null; +/** + * Get the date that the startDate - validThroughBeforeStartDate window starts + * + * @param {Offer} offer + * @param {Opportunity} opportunity + * @returns {DateTime | null} null if there is no booking window upper limit defined. + */ +export function getDateBeforeWhichBookingsCanBeMade(offer: Offer, opportunity: Opportunity): any | null; /** * @param {Offer} offer * @param {Opportunity} opportunity @@ -112,7 +120,7 @@ export function mustNotBeOpenBookingInAdvanceUnavailable(offer: import("../types /** * @type {OfferConstraint} */ -export function mustHaveBeInsideValidFromBeforeStartDateWindow(offer: import("../types/Offer").Offer, opportunity: import("../types/Opportunity").Opportunity, options: import("../types/Options").Options): boolean; +export function mustBeInsideBookingWindowIfOneExists(offer: import("../types/Offer").Offer, opportunity: import("../types/Opportunity").Opportunity, options: import("../types/Options").Options): boolean; /** * For a session, get `organizer`. For a facility, get `provider`. * These can be used interchangeably as `organizer` is either a Person or an Organization diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js index f7dbcbb8e8..12839bbaac 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js @@ -2,7 +2,7 @@ const { createCriteria, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, sellerMustAllowOpenBooking, } = require('./criteriaUtils'); const { @@ -32,7 +32,7 @@ const TestOpportunityBookable = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], ], testDataShape: (options) => ({ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js index c090c4a096..8bcd2b751b 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js @@ -7,7 +7,7 @@ const { mustRequireAdditionalDetails, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, mustNotRequireAttendeeDetails, sellerMustAllowOpenBooking, } = require('./criteriaUtils'); @@ -32,7 +32,7 @@ const TestOpportunityBookableAdditionalDetails = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], [ 'Must require additional details', diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js index 678881d83c..56b42407c5 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js @@ -4,7 +4,7 @@ const { mustRequireAttendeeDetails, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, mustNotRequireAdditionalDetails, sellerMustAllowOpenBooking, } = require('./criteriaUtils'); @@ -29,7 +29,7 @@ const TestOpportunityBookableAttendeeDetails = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], [ 'Must require attendee details', diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js index d749e71702..b94f1a0214 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js @@ -2,7 +2,7 @@ const { createCriteria, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, sellerMustAllowOpenBooking, endDateMustBeInThePast, eventStatusMustNotBeCancelledOrPostponed, @@ -45,7 +45,7 @@ const TestOpportunityBookableInPast = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], [ 'Must not require attendee details', diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js index 65ca95f137..a9b0e1394b 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js @@ -1,4 +1,4 @@ -const { createCriteria, getRemainingCapacity, mustNotBeOpenBookingInAdvanceUnavailable, mustHaveBeInsideValidFromBeforeStartDateWindow } = require('./criteriaUtils'); +const { createCriteria, getRemainingCapacity, mustNotBeOpenBookingInAdvanceUnavailable, mustBeInsideBookingWindowIfOneExists } = require('./criteriaUtils'); const { quantitativeValue, shapeConstraintRecipes } = require('../testDataShape'); const { InternalCriteriaFutureScheduledAndDoesNotRequireDetails } = require('./internal/InternalCriteriaFutureScheduledAndDoesNotRequireDetails'); @@ -31,7 +31,7 @@ const TestOpportunityBookableNoSpaces = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], ], testDataShape: (options) => ({ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js index 891c871e7c..61155ec1d7 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js @@ -2,7 +2,7 @@ const { createCriteria, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, sellerMustAllowOpenBooking, mustNotRequireAttendeeDetails, mustNotRequireAdditionalDetails, @@ -51,7 +51,7 @@ const TestOpportunityBookableNonFreePrepaymentUnavailable = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], [ 'Only paid bookable offers with openBookingPrepayment unavailable', diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js index fdc2296921..0ad427e1dd 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js @@ -2,7 +2,7 @@ const { createCriteria, getRemainingCapacity, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, sellerMustAllowOpenBooking, } = require('./criteriaUtils'); const { @@ -43,7 +43,7 @@ const TestOpportunityBookableOneSpace = createCriteria({ ], [ 'Must be within validFromBeforeStartDate window', - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, ], ], testDataShape: (options) => ({ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js index 1c0f000262..a76c8f2eef 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js @@ -1,4 +1,4 @@ -const { getDateAfterWhichBookingsCanBeMade, remainingCapacityMustBeAtLeastTwo, createCriteria, mustNotBeOpenBookingInAdvanceUnavailable } = require('./criteriaUtils'); +const { getDateAfterWhichBookingsCanBeMade, getDateBeforeWhichBookingsCanBeMade, remainingCapacityMustBeAtLeastTwo, createCriteria, mustNotBeOpenBookingInAdvanceUnavailable } = require('./criteriaUtils'); const { dateRange, shapeConstraintRecipes } = require('../testDataShape'); const { InternalCriteriaFutureScheduledAndDoesNotRequireDetails } = require('./internal/InternalCriteriaFutureScheduledAndDoesNotRequireDetails'); @@ -11,13 +11,12 @@ const { InternalCriteriaFutureScheduledAndDoesNotRequireDetails } = require('./i */ function mustHaveBookingWindowAndBeOutsideOfIt(offer, opportunity, options) { const dateAfterWhichBookingsCanBeMade = getDateAfterWhichBookingsCanBeMade(offer, opportunity); - if (dateAfterWhichBookingsCanBeMade == null) { - return false; // has no booking window - } + const dateBeforeWhichBookingsCanBeMade = getDateBeforeWhichBookingsCanBeMade(offer, opportunity); /* If, within 2 hours, the booking window would be reached, it may be possible for this to happen during the test run. So, to be on the safe side, we only accept Opportunities whose booking window starts at least 2 hours in the future. */ - return options.harvestStartTimeTwoHoursLater < dateAfterWhichBookingsCanBeMade; + return (dateAfterWhichBookingsCanBeMade !== null && options.harvestStartTimeTwoHoursLater < dateAfterWhichBookingsCanBeMade) + || (dateBeforeWhichBookingsCanBeMade !== null && options.harvestStartTime > dateBeforeWhichBookingsCanBeMade); } /** @@ -51,6 +50,9 @@ const TestOpportunityBookableOutsideValidFromBeforeStartDate = createCriteria({ 'oa:validFromBeforeStartDate': dateRange({ minDate: options.harvestStartTimeTwoHoursLater.toISO(), }), + 'oa:validThroughBeforeStartDate': dateRange({ + maxDate: options.harvestStartTime.toISO(), + }), }, }), }); diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js index 802b386b63..ba2deba5f9 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js @@ -1,5 +1,5 @@ const { TestOpportunityBookable } = require('./TestOpportunityBookable'); -const { createCriteria, getDateAfterWhichBookingsCanBeMade } = require('./criteriaUtils'); +const { createCriteria, getDateAfterWhichBookingsCanBeMade, getDateBeforeWhichBookingsCanBeMade } = require('./criteriaUtils'); const { dateRange } = require('../testDataShape'); /** @@ -11,10 +11,15 @@ const { dateRange } = require('../testDataShape'); */ function mustHaveBookingWindowAndBeWithinIt(offer, opportunity, options) { const dateAfterWhichBookingsCanBeMade = getDateAfterWhichBookingsCanBeMade(offer, opportunity); - if (dateAfterWhichBookingsCanBeMade == null) { + const dateBeforeWhichBookingsCanBeMade = getDateBeforeWhichBookingsCanBeMade(offer, opportunity); + if (dateAfterWhichBookingsCanBeMade == null && dateBeforeWhichBookingsCanBeMade == null) { return false; // has no booking window } - return options.harvestStartTime > dateAfterWhichBookingsCanBeMade; + /* If, within 2 hours, the end of the booking window would be reached, it may be possible for this to happen + during the test run. So, to be on the safe side, we only accept Opportunities whose booking window + ends at least 2 hours in the future. */ + return (dateAfterWhichBookingsCanBeMade == null || options.harvestStartTime > dateAfterWhichBookingsCanBeMade) + && (dateBeforeWhichBookingsCanBeMade == null || options.harvestStartTimeTwoHoursLater < dateBeforeWhichBookingsCanBeMade); } const TestOpportunityBookableWithinValidFromBeforeStartDate = createCriteria({ @@ -22,7 +27,7 @@ const TestOpportunityBookableWithinValidFromBeforeStartDate = createCriteria({ opportunityConstraints: [], offerConstraints: [ [ - 'Must have booking window (`validFromBeforeStartDate`) and be within it', + 'Must have booking window (`validFromBeforeStartDate` or `validThroughBeforeStartDate`) and be within it', mustHaveBookingWindowAndBeWithinIt, ], ], @@ -34,6 +39,10 @@ const TestOpportunityBookableWithinValidFromBeforeStartDate = createCriteria({ maxDate: options.harvestStartTime.toISO(), // This differs from TestOpportunityBookable as it does not allow null values }), + 'oa:validThroughBeforeStartDate': dateRange({ + minDate: options.harvestStartTimeTwoHoursLater.toISO(), + // This differs from TestOpportunityBookable as it does not allow null values + }), }, }), }); diff --git a/packages/test-interface-criteria/src/criteria/criteriaUtils.js b/packages/test-interface-criteria/src/criteria/criteriaUtils.js index bda38a310c..203b8790b4 100644 --- a/packages/test-interface-criteria/src/criteria/criteriaUtils.js +++ b/packages/test-interface-criteria/src/criteria/criteriaUtils.js @@ -277,7 +277,7 @@ function dateMinusDuration(datetimeIso, durationIso) { * * @param {Offer} offer * @param {Opportunity} opportunity - * @returns {DateTime | null} null if there is no booking window defined. + * @returns {DateTime | null} null if there is no booking window lower limit defined. */ function getDateAfterWhichBookingsCanBeMade(offer, opportunity) { if (!offer || !offer.validFromBeforeStartDate) { @@ -287,6 +287,21 @@ function getDateAfterWhichBookingsCanBeMade(offer, opportunity) { return dateMinusDuration(opportunity.startDate, offer.validFromBeforeStartDate); } +/** + * Get the date that the startDate - validThroughBeforeStartDate window starts + * + * @param {Offer} offer + * @param {Opportunity} opportunity + * @returns {DateTime | null} null if there is no booking window upper limit defined. + */ +function getDateBeforeWhichBookingsCanBeMade(offer, opportunity) { + if (!offer || !offer.validThroughBeforeStartDate) { + return null; // has no booking window + } + + return dateMinusDuration(opportunity.startDate, offer.validThroughBeforeStartDate); +} + /** * @type {OfferConstraint} */ @@ -374,10 +389,14 @@ function mustNotBeOpenBookingInAdvanceUnavailable(offer) { /** * @type {OfferConstraint} */ -function mustHaveBeInsideValidFromBeforeStartDateWindow(offer, opportunity, options) { +function mustBeInsideBookingWindowIfOneExists(offer, opportunity, options) { const dateAfterWhichBookingsCanBeMade = getDateAfterWhichBookingsCanBeMade(offer, opportunity); - if (dateAfterWhichBookingsCanBeMade == null) { return true; } // no booking window - therefore bookable at any time - return options.harvestStartTime > dateAfterWhichBookingsCanBeMade; + const dateBeforeWhichBookingsCanBeMade = getDateBeforeWhichBookingsCanBeMade(offer, opportunity); + /* If, within 2 hours, the end of the booking window would be reached, it may be possible for this to happen + during the test run. So, to be on the safe side, we only accept Opportunities whose booking window + ends at least 2 hours in the future. */ + return (dateAfterWhichBookingsCanBeMade == null || options.harvestStartTime > dateAfterWhichBookingsCanBeMade) + && (dateBeforeWhichBookingsCanBeMade == null || options.harvestStartTimeTwoHoursLater < dateBeforeWhichBookingsCanBeMade); } /** @@ -476,6 +495,7 @@ module.exports = { getType, getRemainingCapacity, getDateAfterWhichBookingsCanBeMade, + getDateBeforeWhichBookingsCanBeMade, getDateBeforeWhichCancellationsCanBeMade, hasCapacityLimitOfOne, remainingCapacityMustBeAtLeastTwo, @@ -486,7 +506,7 @@ module.exports = { endDateMustBeInThePast, eventStatusMustNotBeCancelledOrPostponed, mustNotBeOpenBookingInAdvanceUnavailable, - mustHaveBeInsideValidFromBeforeStartDateWindow, + mustBeInsideBookingWindowIfOneExists, getOrganizerOrProvider, mustBeOutsideCancellationWindow, mustNotAllowFullRefund, From 368d37d2552e34ae72e359cb287118f074de6e5d Mon Sep 17 00:00:00 2001 From: Nick Evans <2616208+nickevansuk@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:24:33 +0100 Subject: [PATCH 2/2] fix: Remove conflicting booking window constraint (#606) --- .../src/criteria/TestOpportunityBookable.js | 2 +- .../src/criteria/TestOpportunityBookableAdditionalDetails.js | 2 +- .../src/criteria/TestOpportunityBookableAttendeeDetails.js | 2 +- .../src/criteria/TestOpportunityBookableInPast.js | 5 ----- .../src/criteria/TestOpportunityBookableNoSpaces.js | 2 +- .../TestOpportunityBookableNonFreePrepaymentUnavailable.js | 2 +- .../src/criteria/TestOpportunityBookableOneSpace.js | 2 +- ...TestOpportunityBookableOutsideValidFromBeforeStartDate.js | 2 +- .../TestOpportunityBookableWithinValidFromBeforeStartDate.js | 2 +- 9 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js index 12839bbaac..0c9127d783 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookable.js @@ -31,7 +31,7 @@ const TestOpportunityBookable = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], ], diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js index 8bcd2b751b..926a0c49cd 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAdditionalDetails.js @@ -31,7 +31,7 @@ const TestOpportunityBookableAdditionalDetails = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], [ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js index 56b42407c5..6d1d50ada4 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableAttendeeDetails.js @@ -28,7 +28,7 @@ const TestOpportunityBookableAttendeeDetails = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], [ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js index b94f1a0214..60d64fe411 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableInPast.js @@ -2,7 +2,6 @@ const { createCriteria, remainingCapacityMustBeAtLeastTwo, mustNotBeOpenBookingInAdvanceUnavailable, - mustBeInsideBookingWindowIfOneExists, sellerMustAllowOpenBooking, endDateMustBeInThePast, eventStatusMustNotBeCancelledOrPostponed, @@ -43,10 +42,6 @@ const TestOpportunityBookableInPast = createCriteria({ 'openBookingInAdvance of offer must not be `https://openactive.io/Unavailable`', mustNotBeOpenBookingInAdvanceUnavailable, ], - [ - 'Must be within validFromBeforeStartDate window', - mustBeInsideBookingWindowIfOneExists, - ], [ 'Must not require attendee details', mustNotRequireAttendeeDetails, diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js index a9b0e1394b..9fcf5eb213 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNoSpaces.js @@ -30,7 +30,7 @@ const TestOpportunityBookableNoSpaces = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], ], diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js index 61155ec1d7..292aa65614 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableNonFreePrepaymentUnavailable.js @@ -50,7 +50,7 @@ const TestOpportunityBookableNonFreePrepaymentUnavailable = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], [ diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js index 0ad427e1dd..0a392a1879 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOneSpace.js @@ -42,7 +42,7 @@ const TestOpportunityBookableOneSpace = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be within validFromBeforeStartDate window', + 'Must be within the booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) if one exists', mustBeInsideBookingWindowIfOneExists, ], ], diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js index a76c8f2eef..95aea04377 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js @@ -36,7 +36,7 @@ const TestOpportunityBookableOutsideValidFromBeforeStartDate = createCriteria({ mustNotBeOpenBookingInAdvanceUnavailable, ], [ - 'Must be outside booking window (`validFromBeforeStartDate`)', + 'Must have a booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) and be outside of it', mustHaveBookingWindowAndBeOutsideOfIt, ], ], diff --git a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js index ba2deba5f9..294af0b0a5 100644 --- a/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js +++ b/packages/test-interface-criteria/src/criteria/TestOpportunityBookableWithinValidFromBeforeStartDate.js @@ -27,7 +27,7 @@ const TestOpportunityBookableWithinValidFromBeforeStartDate = createCriteria({ opportunityConstraints: [], offerConstraints: [ [ - 'Must have booking window (`validFromBeforeStartDate` or `validThroughBeforeStartDate`) and be within it', + 'Must have a booking window (`validFromBeforeStartDate` and/or `validThroughBeforeStartDate`) and be within it', mustHaveBookingWindowAndBeWithinIt, ], ],