-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Separate out past-opportunities feature (#696)
So that it may be opted out of if no past data is available (esp. if using random mode)
- Loading branch information
1 parent
451c7c9
commit de2979f
Showing
12 changed files
with
107 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...es/openactive-integration-tests/test/features/core/past-opportunities/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[< Return to Overview](../../README.md) | ||
# Past opportunities (past-opportunities) | ||
|
||
For booking systems that support opportunities in the past, ensure that these are not bookable | ||
|
||
|
||
https://openactive.io/open-booking-api/EditorsDraft/#error-model | ||
|
||
Coverage Status: **complete** | ||
### Test prerequisites - Opportunities | ||
Opportunities that match the following criteria must exist in the booking system (for each configured `bookableOpportunityTypesInScope`) for the configured primary Seller in order to use `useRandomOpportunities: true`. Alternatively the following `testOpportunityCriteria` values must be supported by the [test interface](https://openactive.io/test-interface/) of the booking system for `useRandomOpportunities: false`. | ||
|
||
[TestOpportunityBookableInPast](https://openactive.io/test-interface#TestOpportunityBookableInPast) x3, [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x1 | ||
|
||
|
||
|
||
### Running tests for only this feature | ||
|
||
```bash | ||
npm start -- --runInBand test/features/core/past-opportunities/ | ||
``` | ||
|
||
|
||
|
||
## 'Implemented' tests | ||
|
||
Update `default.json` within `packages/openactive-integration-tests/config/` as follows to enable 'Implemented' testing for this feature: | ||
|
||
```json | ||
"implementedFeatures": { | ||
... | ||
"past-opportunities": true, | ||
... | ||
} | ||
``` | ||
|
||
| Identifier | Name | Description | Prerequisites per Opportunity Type | Required Test Interface Actions | | ||
|------------|------|-------------|---------------|-------------------| | ||
| [opportunity-in-past](./implemented/opportunity-in-past-test.js) | Expect an OpportunityOfferPairNotBookableError when opportunity is in the past | Runs C1, C2 and B for an opportunity in the past, expecting an OpportunityOfferPairNotBookableError to be returned at C1, C2, and B | [TestOpportunityBookableInPast](https://openactive.io/test-interface#TestOpportunityBookableInPast) x3, [TestOpportunityBookable](https://openactive.io/test-interface#TestOpportunityBookable) x1 | | | ||
|
||
|
||
|
||
## 'Not Implemented' tests | ||
|
||
|
||
Update `default.json` within `packages/openactive-integration-tests/config/` as follows to enable 'Not Implemented' testing for this feature: | ||
|
||
```json | ||
"implementedFeatures": { | ||
... | ||
"past-opportunities": false, | ||
... | ||
} | ||
``` | ||
|
||
| Identifier | Name | Description | Prerequisites per Opportunity Type | Required Test Interface Actions | | ||
|------------|------|-------------|---------------|-------------------| | ||
| [no-past-opportunities](./not-implemented/no-past-opportunities-test.js) | The open data feeds must not contain any opportunities with `startDate` in the past | Assert that no opportunities that match criteria 'TestOpportunityBookableInPast' are available in the opportunity feeds. | | | |
10 changes: 10 additions & 0 deletions
10
packages/openactive-integration-tests/test/features/core/past-opportunities/feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"category": "core", | ||
"identifier": "past-opportunities", | ||
"name": "Past opportunities", | ||
"description": "For booking systems that support opportunities in the past, ensure that these are not bookable", | ||
"explainer": "", | ||
"specificationReference": "https://openactive.io/open-booking-api/EditorsDraft/#error-model", | ||
"required": false, | ||
"coverageStatus": "complete" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...tests/test/features/core/past-opportunities/not-implemented/no-past-opportunities-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
|
||
FeatureHelper.describeUnmatchedCriteriaFeature(module, { | ||
testCategory: 'core', | ||
testFeature: 'past-opportunities', | ||
testFeatureImplemented: false, | ||
testIdentifier: 'no-past-opportunities', | ||
testName: 'The open data feeds must not contain any opportunities with `startDate` in the past', | ||
unmatchedOpportunityCriteria: [ | ||
'TestOpportunityBookableInPast', | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters