-
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: Add single-seller feature, which is mutually exclusive with mul…
…tiple-sellers (#640)
- Loading branch information
1 parent
e2f4329
commit 589099d
Showing
16 changed files
with
194 additions
and
6 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
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
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
13 changes: 13 additions & 0 deletions
13
...sts/test/features/core/multiple-sellers/not-implemented/single-seller-implemented-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,13 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
|
||
FeatureHelper.describeFeatureShouldBeImplementedIfOtherFeaturesAreNot(module, { | ||
testCategory: 'core', | ||
testFeature: 'multiple-sellers', | ||
testFeatureImplemented: false, | ||
testIdentifier: 'single-seller-implemented', | ||
testName: 'Single Seller feature must be implemented if Multiple Sellers is not implemented', | ||
testDescription: 'Either one, and only one, of the Multiple Sellers feature and the Single Seller feature must be implemented', | ||
otherFeaturesWhichAreMutuallyExclusiveWithThisOne: [ | ||
'single-seller', | ||
], | ||
}); |
54 changes: 54 additions & 0 deletions
54
packages/openactive-integration-tests/test/features/core/single-seller/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,54 @@ | ||
[< Return to Overview](../../README.md) | ||
# Single Seller (single-seller) | ||
|
||
The booking system only supports providing services to one seller. | ||
|
||
|
||
https://openactive.io/open-booking-api/EditorsDraft/#booking-pre-conditions | ||
|
||
Coverage Status: **complete** | ||
|
||
|
||
|
||
### Running tests for only this feature | ||
|
||
```bash | ||
npm start -- --runInBand test/features/core/single-seller/ | ||
``` | ||
|
||
|
||
|
||
## 'Implemented' tests | ||
|
||
Update `default.json` within `packages/openactive-integration-tests/config/` as follows to enable 'Implemented' testing for this feature: | ||
|
||
```json | ||
"implementedFeatures": { | ||
... | ||
"single-seller": true, | ||
... | ||
} | ||
``` | ||
|
||
| Identifier | Name | Description | Prerequisites per Opportunity Type | | ||
|------------|------|-------------|---------------| | ||
| [only-primary-seller-configured](./implemented/only-primary-seller-configured-test.js) | Only the primary seller should be configured | If the single-seller feature is implemented, multiple-sellers is not enabled, and so a secondary seller should not be configured. | | | ||
|
||
|
||
|
||
## 'Not Implemented' tests | ||
|
||
|
||
Update `default.json` within `packages/openactive-integration-tests/config/` as follows to enable 'Not Implemented' testing for this feature: | ||
|
||
```json | ||
"implementedFeatures": { | ||
... | ||
"single-seller": false, | ||
... | ||
} | ||
``` | ||
|
||
| Identifier | Name | Description | Prerequisites per Opportunity Type | | ||
|------------|------|-------------|---------------| | ||
| [multiple-sellers-implemented](./not-implemented/multiple-sellers-implemented-test.js) | Multiple Sellers feature must be implemented if Single Seller is not implemented | Either one, and only one, of the Multiple Sellers feature and Single Seller feature must be implemented | | |
10 changes: 10 additions & 0 deletions
10
packages/openactive-integration-tests/test/features/core/single-seller/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": "single-seller", | ||
"name": "Single Seller", | ||
"description": "The booking system only supports providing services to one seller.", | ||
"explainer": "", | ||
"specificationReference": "https://openactive.io/open-booking-api/EditorsDraft/#booking-pre-conditions", | ||
"required": false, | ||
"coverageStatus": "complete" | ||
} |
21 changes: 21 additions & 0 deletions
21
...tests/test/features/core/single-seller/implemented/only-primary-seller-configured-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,21 @@ | ||
const { expect } = require('chai'); | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
|
||
const { SELLER_CONFIG } = global; | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'core', | ||
testFeature: 'single-seller', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'only-primary-seller-configured', | ||
testName: 'Only the primary seller should be configured', | ||
testDescription: 'If the single-seller feature is implemented, multiple-sellers is not enabled, and so a secondary seller should not be configured.', | ||
doesNotUseOpportunitiesMode: true, | ||
}, () => { | ||
describe('Feature', () => { | ||
it('should only be implemented if there is only one `primary` seller configured', () => { | ||
expect(SELLER_CONFIG).to.have.nested.property('primary.@id'); | ||
expect(SELLER_CONFIG).to.not.have.nested.property('secondary.@id'); | ||
}); | ||
}); | ||
}); |
13 changes: 13 additions & 0 deletions
13
...sts/test/features/core/single-seller/not-implemented/multiple-sellers-implemented-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,13 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
|
||
FeatureHelper.describeFeatureShouldBeImplementedIfOtherFeaturesAreNot(module, { | ||
testCategory: 'core', | ||
testFeature: 'single-seller', | ||
testFeatureImplemented: false, | ||
testIdentifier: 'multiple-sellers-implemented', | ||
testName: 'Multiple Sellers feature must be implemented if Single Seller is not implemented', | ||
testDescription: 'Either one, and only one, of the Multiple Sellers feature and Single Seller feature must be implemented', | ||
otherFeaturesWhichAreMutuallyExclusiveWithThisOne: [ | ||
'multiple-sellers', | ||
], | ||
}); |
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
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