Skip to content
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

Merged
merged 13 commits into from
Mar 13, 2024

Conversation

civsiv
Copy link
Contributor

@civsiv civsiv commented Sep 14, 2023

Closes #528

Broker working and harvesting correctly:
Screenshot 2023-09-14 at 12 18 18

packages/openactive-broker-microservice/app.js Outdated Show resolved Hide resolved
// Assertions
expect(result).to.have.lengthOf(3);

expect(result[0]).to.have.property('id', '1');
Copy link
Contributor

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

Copy link
Contributor Author

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',
Copy link
Contributor

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

@@ -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);
Copy link
Contributor Author

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'],
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great spot

@civsiv
Copy link
Contributor Author

civsiv commented Mar 11, 2024

Screenshot 2024-03-11 at 10 25 54 All still working as expected

@civsiv civsiv merged commit 7de7990 into master Mar 13, 2024
32 checks passed
@civsiv civsiv deleted the feature/broker-unit-tests branch March 13, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests to the openactive-broker-microservice
2 participants