Add test-data-generator#326
Conversation
…uirements. More work to go
…can possibly later be used to generate constraints ( ͡° ͜ʖ ͡°)
| "test:startDateMin": "2020-12-20", | ||
| "test:startDateMax": "2020-12-25" |
There was a problem hiding this comment.
Just on this part of the model, I wonder whether we should have the requirements within a single type - given this is how they're likely processed, and also given that the requirements include a mix of opportunityRequirements and orderRequirements, so perhaps don't make sense on the Event itself, so e.g.
| "test:startDateMin": "2020-12-20", | |
| "test:startDateMax": "2020-12-25" | |
| "test:testDataRequirements": { | |
| "@type": "test:TestDataRequirements", | |
| "test:startDateMin": "2020-12-20", | |
| "test:startDateMax": "2020-12-25" | |
| } |
Alternatively perhaps we create a separation between opportunity and offer requirements...? This might make it more obvious which is which when processing, and also mirrors the separation that exists within the existing criteria?
| "test:startDateMin": "2020-12-20", | |
| "test:startDateMax": "2020-12-25" | |
| "test:testOpportunityDataRequirements": { | |
| "@type": "test:OpportunityTestDataRequirements", | |
| "test:startDateMin": "2020-12-20", | |
| "test:startDateMax": "2020-12-25" | |
| } | |
| "test:testOfferDataRequirements": { | |
| "@type": "test:OfferTestDataRequirements", | |
| "test:availableChannelIncludes": [ | |
| "availableChannelIncludes" | |
| ] | |
| } |
There was a problem hiding this comment.
@nickevansuk I agree with both suggestions.
Also, I wonder if we should structure the fields themselves? There's turning out to be a lot of different fields. It would be easier to implement (for external Booking Systems) if we abstracted the commonalities.
I've given a rough idea of what this might look like here at the top of TestDataRequirements.d.ts (and you can also see how many different fields there are so far. I've extended your suffix scheme for organising them)
If the fields are unstructured, a BS's logic might look like (for a controlled "create opportunity" request):
const prepayment = generateChoice(PREPAYMENT_OPTIONS, {
allowlist: testDataRequirements.prepaymentAllowlist,
blocklist: null,
allowNull: testDataRequirements.prepaymentAllowNull,
});
const eventStatus = generateChoice(EVENT_STATUS_OPTIONS, {
allowlist: null,
blocklist: testDataRequirements.eventStatusBlocklist,
allowNull: null
});EW. And what if we eventually add a prepaymentBlocklist field - they'd have to add it (or more likely - not realise and start generating incorrect data).
If the fields are structured, the same BS's logic might look like:
const prepayment = generateField(testDataRequirements.prepayment);
const eventStatus = generateField(testDataRequirements.eventStatus);The field could look like:
prepayment: {
type: 'Allowlist',
mustBeOneOf: ['https://openactive.io/Unavailable'],
valueType: 'oa:RequiredStatusType',
}Therefore, the BS's generateField(..) function could generate everything it needs to from that definition, and would allow for adding new criteria or updating existing criteria without breaking existing BSs (unless we add a new type of requirement OR add new fields)
…portunityNotBookableViaAvailableChannel
…FiveSpaces, -FlowRequirementOnlyApproval, -Free
* update merging logic so it just errors if there are overlapping requirements (this can be fixed as and when) ; TS all passes now
…s/criteria-requirements.json Also, cleanup documentation generator a bit and use __dirname for file paths so that script wont fail if run from a different directory than originally designed
|
From your Node.js checklist above, what new criteria is this point referring to?
|
* refactor: Move createTestInterfaceOpportunity(..) out of RequestHelper so it can also be used by test-data-generator script * chore: Type TestInterfaceOpportunity
AND, get TS types for config values in integration tests
…ng work needs to happen
…eneration runs but with a small issue
f3c8404 to
73c27ee
Compare
|
Note merging this Node.js work ahead of completion of other aspects to consolidate branches |
A PR for generating test data reliably
Work remaining
Node.js
Spec
.NET
Also this from my rough notes if helpful: