-
Notifications
You must be signed in to change notification settings - Fork 4
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
[CI-3342] Pass section to getRecommendationPods #197
Conversation
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.
Changes lgtm. Some small comments.
it('Should build requestURL with query params when parameters are passed', (done) => { | ||
const { recommendations } = new ConstructorIO({ | ||
...validOptions, | ||
fetch: async (reqUrl) => ({ ok: true, json: async () => reqUrl }), |
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.
Thoughts on not overriding fetch here, actually sending a request?
While this is arguably better, closer to what a unit test should be, the rest of the tests all send requests, so I'm wondering if we should stick with that.
But tbh, doens't matter too much.
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.
I think in this specific case I'm just trying to test that the request url gets built correctly, and not as concerned with the response. I can add an extra test that sends the request with these parameters for coverage
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.
I think both approaches are fine but let's test the live request like Stanley mentioned. We can either
- Not override fetch and check both the request url and response in this test
- Leave this test as is and create a new test that's using actual fetch and hitting the API
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.
added the test 👍. I think it's good to have both just to make sure the parameter is getting added to the url as expected, at least while we have this hacky workaround with parameters/network parameters
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.
LGTM
Pass section to getRecommendationPods through parameters.
To maintain backwards compatibility, parameters will be treated as networkParameters in some cases. This is until all customers migrate to using both parameters.