New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(opportunity-outside-range-c1-c2) #244
feature(opportunity-outside-range-c1-c2) #244
Conversation
...est/features/restrictions/booking-window/implemented/opportunity-outside-range-c1-c2-test.js
Outdated
Show resolved
Hide resolved
f7c9275
to
67a0469
Compare
Also note that the artifact from CI on this branch on the last test run also includes the following error: For this line: Which suggests issues with the .NET logic |
...est/features/restrictions/booking-window/implemented/opportunity-outside-range-c1-c2-test.js
Outdated
Show resolved
Hide resolved
@@ -65,7 +65,7 @@ function getRemainingCapacity(opportunity) { | |||
*/ | |||
function mustBeWithinBookingWindow(offer, opportunity) { | |||
if (!offer || !offer.validFromBeforeStartDate) { | |||
return false; | |||
return null; // Required for validation step |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, what's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it, validation fails, complaining that the string isn't a valid ISO offset. It would also work fine with false
, but I wanted to make it explicit that it can't be within or outside the booking window if there is no booking window.
...st-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js
Show resolved
Hide resolved
...st-interface-criteria/src/criteria/TestOpportunityBookableOutsideValidFromBeforeStartDate.js
Outdated
Show resolved
Hide resolved
404edf5
to
7332a44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just picked up on a couple of things
* asynchronous before() block has completed. | ||
*/ | ||
function itShouldReturnOpportunityOfferPairNotBookableError(stage, responseAccessor) { | ||
it('should return OpportunityOfferPairNotBookableError', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this should only be checking for errors in non-control items, and no errors in control items. A mirror of this example:
Lines 48 to 77 in 07f80ff
Common.itForOrderItemByControl(orderItemCriteria, state, stage, () => responseAccessor().body, | |
'should include an OpportunityIsFullError', | |
(feedOrderItem, responseOrderItem, responseOrderItemErrorTypes) => { | |
chai.expect(responseOrderItemErrorTypes).to.include('OpportunityIsFullError'); | |
if (responseOrderItem.orderedItem['@type'] === 'Slot') { | |
chai.expect(responseOrderItem).to.nested.include({ | |
'orderedItem.remainingUses': 0, | |
}); | |
} else { | |
chai.expect(responseOrderItem).to.nested.include({ | |
'orderedItem.remainingAttendeeCapacity': 0, | |
}); | |
} | |
}, | |
'should not include an OpportunityIsFullError', | |
(feedOrderItem, responseOrderItem, responseOrderItemErrorTypes) => { | |
chai.expect(responseOrderItemErrorTypes).not.to.include('OpportunityIsFullError'); | |
if (responseOrderItem.orderedItem['@type'] === 'Slot') { | |
chai.expect(responseOrderItem).to.nested.include({ | |
'orderedItem.remainingUses': feedOrderItem.orderedItem.remainingUses, | |
}); | |
} else { | |
chai.expect(responseOrderItem).to.nested.include({ | |
'orderedItem.remainingAttendeeCapacity': feedOrderItem.orderedItem.remainingAttendeeCapacity, | |
}); | |
} | |
}); | |
}; |
return (Array.isArray(offer.availableChannel) && offer.availableChannel.includes('https://openactive.io/OpenBookingPrepayment')) | ||
&& offer.advanceBooking !== 'https://openactive.io/Unavailable' | ||
&& (!offer.validFromBeforeStartDate || moment(opportunity.startDate).subtract(moment.duration(offer.validFromBeforeStartDate)).isBefore(options.harvestStartTime)); | ||
&& (!offer.validFromBeforeStartDate || moment(opportunity.startDate).subtract(moment.duration(offer.validFromBeforeStartDate)).isBefore()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line seems to be revertiing the options.harvestStartTime change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge screw-up
57b9e23
to
2009a79
Compare
66f0b00
to
1717a79
Compare
No description provided.