-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: add broker tests for feed item transforms #576
Conversation
packages/openactive-broker-microservice/src/twoPhaseListeners/api.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/src/twoPhaseListeners/api.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/src/util/item-transforms.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/src/util/item-transforms.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/src/util/item-transforms.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/test/util/item-transforms-test.js
Outdated
Show resolved
Hide resolved
packages/openactive-broker-microservice/test/util/item-transforms-test.js
Outdated
Show resolved
Hide resolved
// Assertions | ||
expect(result).to.have.lengthOf(3); | ||
|
||
expect(result[0]).to.have.property('id', '1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I know this is outside of the scope of your changes but do you happen to know why this function changes the RPDE ID to match the IFU's DATA ID? That seems like it could cause issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To simulate the subEvents coming from a separate feed, each item will need a unique RPDE ID right? So I think it just uses the data ID so that an RPDE ID doesn't have to made up maybe?
|
||
// Assertions | ||
expect(opportunityItem).to.deep.equal({ | ||
id: 'https://example.com/subEvent/1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question for this function if you happen to know
…ms.js Co-authored-by: Luke Winship <[email protected]>
…ms.js Co-authored-by: Luke Winship <[email protected]>
…tive/openactive-test-suite into feature/broker-unit-tests
@@ -1130,29 +1139,10 @@ async function ingestParentOpportunityPage(rpdePage, feedIdentifier, validateIte | |||
// present in the list of new subEvents, then it has been deleted and so we remove the associated | |||
// opportunityItem data. If a new subEvent is not present in the list of old subEvents, then we | |||
// record its ID in the list for the next time this check is done. | |||
|
|||
const oldSubEventIds = state.parentOpportunitySubEventMap.get(jsonLdId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this to it's own function as it was getting my brains way
return item.data.individualFacilityUse.map((individualFacilityUse) => ({ | ||
...item, | ||
kind: individualFacilityUse['@type'], | ||
id: individualFacilityUse['@id'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the type definition above, and line 1094 in app.js, should this be || individualFacilityUse.id
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great spot
Closes #528
Broker working and harvesting correctly: