-
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.
Coverage/reseller and nobroker role (#298)
* - tests for nobroker and reseller broker roles * -auto readme changes * moved brokerRole to template data & use in C1/C2 & test C1/C2 for broker-included-nobroker-mode * slight test doc update * customer-not-included-nobroker-mode: C2 & B * reseller-broker tests * oopsie * lint fix validation.js * Remove validation for C2 in test due to spec error (issue raised) * add runtimeVersion to launch json Co-authored-by: Luke Winship <luke.winship@gmail.com> Co-authored-by: Luke Winship <luke.winship@googlemail.com> Co-authored-by: Civ Sivakumaran <civ@imin.co>
- Loading branch information
1 parent
96d8a0b
commit a4442b0
Showing
11 changed files
with
307 additions
and
49 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
58 changes: 58 additions & 0 deletions
58
...sts/test/features/broker-role/no-broker/implemented/broker-included-nobroker-mode-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,58 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
const { FlowStageRecipes, FlowStageUtils } = require('../../../../helpers/flow-stages'); | ||
const { runFlowStageAndExpectIncompleteBrokerDetailsError } = require('../../../../shared-behaviours/errors'); | ||
|
||
// /** | ||
// * @typedef {import('../../../../helpers/flow-stages/c1').C1FlowStageType} C1FlowStageType | ||
// * @typedef {import('../../../../helpers/flow-stages/c2').C2FlowStageType} C2FlowStageType | ||
// * @typedef {import('../../../../helpers/flow-stages/b').BFlowStageType} BFlowStageType | ||
// */ | ||
|
||
// /** | ||
// * @param {C1FlowStageType | C2FlowStageType | BFlowStageType} flowStage | ||
// */ | ||
// function runFlowStageAndExpectIncompleteBrokerDetailsError(flowStage) { | ||
// FlowStageUtils.describeRunAndCheckIsValid(flowStage, () => { | ||
// itShouldReturnAnOpenBookingError('IncompleteBrokerDetailsError', 400, () => flowStage.getOutput().httpResponse); | ||
// }); | ||
// } | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'broker-role', | ||
testFeature: 'no-broker', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'broker-included-nobroker-mode', | ||
testName: 'Broker included in Order in NoBroker mode', | ||
testDescription: 'Request shoud fail if broker is included in Order in NoBroker mode for C1, C2 & B request.', | ||
// The primary opportunity criteria to use for the primary OrderItem under test | ||
testOpportunityCriteria: 'TestOpportunityBookable', | ||
// The secondary opportunity criteria to use for multiple OrderItem tests | ||
controlOpportunityCriteria: 'TestOpportunityBookable', | ||
}, | ||
function (configuration, orderItemCriteriaList, featureIsImplemented, logger) { | ||
describe('Booking should fail because Broker is included in Order in NoBroker mode', () => { | ||
describe('at C1', () => { | ||
// broker is included, by default, in C1 request | ||
const { fetchOpportunities, c1 } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { brokerRole: 'https://openactive.io/NoBroker' }); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(c1); | ||
}); | ||
describe('at C2', () => { | ||
// broker is included, by default, in C2 request | ||
const { fetchOpportunities, c1, c2 } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { brokerRole: 'https://openactive.io/NoBroker', c1ReqTemplateRef: 'noBroker' }); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(c2); | ||
}); | ||
describe('at B', () => { | ||
// broker is included, by default, in B request | ||
const { fetchOpportunities, c1, c2, b } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { | ||
brokerRole: 'https://openactive.io/NoBroker', c1ReqTemplateRef: 'noBroker', c2ReqTemplateRef: 'noBroker', | ||
}); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c2); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(b); | ||
}); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
...s/test/features/broker-role/no-broker/implemented/customer-included-nobroker-mode-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,27 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
const { FlowStageRecipes, FlowStageUtils } = require('../../../../helpers/flow-stages'); | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'broker-role', | ||
testFeature: 'no-broker', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'customer-included-nobroker-mode', | ||
testName: 'Customer included in Order in NoBroker mode', | ||
testDescription: 'Request shoud succeed if broker is excluded and customer is included in Order in NoBroker mode for C1, C2 & B request.', | ||
// The primary opportunity criteria to use for the primary OrderItem under test | ||
testOpportunityCriteria: 'TestOpportunityBookable', | ||
// The secondary opportunity criteria to use for multiple OrderItem tests | ||
controlOpportunityCriteria: 'TestOpportunityBookable', | ||
}, | ||
function (configuration, orderItemCriteriaList, featureIsImplemented, logger) { | ||
const { fetchOpportunities, c1, c2, b } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { | ||
c1ReqTemplateRef: 'noBroker', c2ReqTemplateRef: 'noBroker', bReqTemplateRef: 'noBroker', brokerRole: 'https://openactive.io/NoBroker', | ||
}); | ||
|
||
describe('In NoBroker mode, booking should succeed if Broker is excluded if Customer is included in Order', () => { | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c2); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(b); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
...st/features/broker-role/no-broker/implemented/customer-not-included-nobroker-mode-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,38 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
const { FlowStageRecipes, FlowStageUtils } = require('../../../../helpers/flow-stages'); | ||
const { runFlowStageAndExpectIncompleteCustomerDetailsError } = require('../../../../shared-behaviours/errors'); | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'broker-role', | ||
testFeature: 'no-broker', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'customer-not-included-nobroker-mode', | ||
testName: 'Customer not included in Order in NoBroker mode', | ||
testDescription: 'Request shoud fail if customer is not included in Order in NoBroker mode for C2 & B requests.', | ||
// The primary opportunity criteria to use for the primary OrderItem under test | ||
testOpportunityCriteria: 'TestOpportunityBookable', | ||
// The secondary opportunity criteria to use for multiple OrderItem tests | ||
controlOpportunityCriteria: 'TestOpportunityBookable', | ||
}, | ||
function (configuration, orderItemCriteriaList, featureIsImplemented, logger) { | ||
describe('Booking should fail even if Customer is not included in Order, because we are in NoBroker mode', () => { | ||
// Note that we ignore testing at C1 because C1 has no customer anyway | ||
describe('at C2', () => { | ||
const { fetchOpportunities, c1, c2 } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { | ||
c1ReqTemplateRef: 'noBroker', c2ReqTemplateRef: 'noCustomerAndNoBroker', brokerRole: 'https://openactive.io/NoBroker', | ||
}); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
runFlowStageAndExpectIncompleteCustomerDetailsError(c2); | ||
}); | ||
describe('at B', () => { | ||
const { fetchOpportunities, c1, c2, b } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { | ||
c1ReqTemplateRef: 'noBroker', c2ReqTemplateRef: 'noBroker', bReqTemplateRef: 'noCustomerAndNoBroker', brokerRole: 'https://openactive.io/NoBroker', | ||
}); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c2); | ||
runFlowStageAndExpectIncompleteCustomerDetailsError(b); | ||
}); | ||
}); | ||
}); |
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
38 changes: 38 additions & 0 deletions
38
...s/broker-role/reseller-broker/implemented/broker-not-included-resellerbroker-mode-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,38 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
const { FlowStageRecipes, FlowStageUtils } = require('../../../../helpers/flow-stages'); | ||
const { runFlowStageAndExpectIncompleteBrokerDetailsError } = require('../../../../shared-behaviours/errors'); | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'broker-role', | ||
testFeature: 'reseller-broker', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'broker-not-included-resellerbroker-mode', | ||
testName: 'Broker not included in Order in ResellerBroker mode', | ||
testDescription: 'Request shoud fail if broker is not included in Order in ResellerBroke mode for B request.', | ||
// The primary opportunity criteria to use for the primary OrderItem under test | ||
testOpportunityCriteria: 'TestOpportunityBookable', | ||
// The secondary opportunity criteria to use for multiple OrderItem tests | ||
controlOpportunityCriteria: 'TestOpportunityBookable', | ||
}, | ||
function (configuration, orderItemCriteriaList, featureIsImplemented, logger) { | ||
describe('Booking should fail because Broker is not included in Order in ResellerBroker mode', () => { | ||
describe('at C1', () => { | ||
const { fetchOpportunities, c1 } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { c1ReqTemplateRef: 'noBroker', brokerRole: 'https://openactive.io/ResellerBroker' }); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(c1); | ||
}); | ||
describe('at C2', () => { | ||
const { fetchOpportunities, c1, c2 } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { c2ReqTemplateRef: 'noBroker', brokerRole: 'https://openactive.io/ResellerBroker' }); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(c2); | ||
}); | ||
describe('at B', () => { | ||
const { fetchOpportunities, c1, c2, b } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { bReqTemplateRef: 'noBroker', brokerRole: 'https://openactive.io/ResellerBroker' }); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c2); | ||
runFlowStageAndExpectIncompleteBrokerDetailsError(b); | ||
}); | ||
}); | ||
}); |
25 changes: 25 additions & 0 deletions
25
...res/broker-role/reseller-broker/implemented/customer-included-resellerbroker-mode-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,25 @@ | ||
const { FeatureHelper } = require('../../../../helpers/feature-helper'); | ||
const { FlowStageRecipes, FlowStageUtils } = require('../../../../helpers/flow-stages'); | ||
|
||
FeatureHelper.describeFeature(module, { | ||
testCategory: 'broker-role', | ||
testFeature: 'reseller-broker', | ||
testFeatureImplemented: true, | ||
testIdentifier: 'customer-included-resellerbroker-mode', | ||
testName: 'Customer included in Order in ResellerBroker mode', | ||
testDescription: 'Request shoud succeed if broker and customer are included in Order in ResellerBroke mode for B request.', | ||
// The primary opportunity criteria to use for the primary OrderItem under test | ||
testOpportunityCriteria: 'TestOpportunityBookable', | ||
// The secondary opportunity criteria to use for multiple OrderItem tests | ||
controlOpportunityCriteria: 'TestOpportunityBookable', | ||
}, | ||
function (configuration, orderItemCriteriaList, featureIsImplemented, logger) { | ||
const { fetchOpportunities, c1, c2, b } = FlowStageRecipes.initialiseSimpleC1C2BFlow(orderItemCriteriaList, logger, { brokerRole: 'https://openactive.io/ResellerBroker' }); | ||
|
||
describe('Booking should succeed if Broker and Customer are included in Order, because we are in ResellerBroker mode', () => { | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(fetchOpportunities); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c1); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(c2); | ||
FlowStageUtils.describeRunAndCheckIsSuccessfulAndValid(b); | ||
}); | ||
}); |
Oops, something went wrong.