Skip to content
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

Merged
merged 5 commits into from Oct 21, 2020

Conversation

lukedawilson
Copy link
Contributor

No description provided.

@lukedawilson lukedawilson force-pushed the coverage/opportunity-outside-range-c1-c2 branch from f7c9275 to 67a0469 Compare October 14, 2020 18:43
@nickevansuk
Copy link
Collaborator

Also note that the artifact from CI on this branch on the last test run also includes the following error:
Error: FAILURE: $.superEvent.offers[0].validFromBeforeStartDate: Invalid type, expected string containing an ISO 8601 Duration but found string.

For this line:
"validFromBeforeStartDate": "-PT11H25M25S"

Which suggests issues with the .NET logic

@@ -65,7 +65,7 @@ function getRemainingCapacity(opportunity) {
*/
function mustBeWithinBookingWindow(offer, opportunity) {
if (!offer || !offer.validFromBeforeStartDate) {
return false;
return null; // Required for validation step
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@lukedawilson lukedawilson force-pushed the coverage/opportunity-outside-range-c1-c2 branch 2 times, most recently from 404edf5 to 7332a44 Compare October 15, 2020 11:36
Copy link
Collaborator

@nickevansuk nickevansuk left a 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', () => {
Copy link
Collaborator

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:

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());
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge screw-up

@lukedawilson lukedawilson force-pushed the coverage/opportunity-outside-range-c1-c2 branch from 57b9e23 to 2009a79 Compare October 16, 2020 15:08
@lukedawilson lukedawilson force-pushed the coverage/opportunity-outside-range-c1-c2 branch from 66f0b00 to 1717a79 Compare October 21, 2020 09:44
@lukedawilson lukedawilson merged commit d839f6b into master Oct 21, 2020
@lukedawilson lukedawilson deleted the coverage/opportunity-outside-range-c1-c2 branch October 21, 2020 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

booking-window - opportunity-in-range-c1-c2 - checkout when outside booking window
3 participants