-
Notifications
You must be signed in to change notification settings - Fork 7
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
test: fix test for pagination cursor #1138
Conversation
|
||
expect((await alerts).length).toBeGreaterThan(1000); | ||
expect((await alerts).length).toBe(50); |
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 don't understand how this tests pagination. Aren't we just fetching 50 alerts without pagination here?
Also autoPagingToArray({ limit: 50 });
will not provide a limit
query param to the API as this is logic for the SDK. If you want to send a limit
query param to the API, then it should be here:
const alerts = client.alerts.list({..., limit: 25})`
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.
Also, this is not a fix
as specified in the PR title and commit.
From the end-users point of view, this PR doesn't fix any bugs.
The proper prefix is test
See the contribution docs: https://github.com/cognitedata/cognite-sdk-js/blob/master/CONTRIBUTING.md#making-changes
@@ -244,55 +245,34 @@ describe('alerts api', () => { | |||
property: 'createdTime', | |||
order: 'desc', | |||
}, | |||
cursor: '', | |||
}); | |||
expect(response.items.length).toBe(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.
No alarm has been created at this point, so why is this expected?
Is it coming from a previous test?
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.
looks like you are testing the pagination correctly. I am not sure I understand how the test is structured though...
In the previous test of the pagination cursor in alert-api, 1001 alerts was created. This created 504s, so we reduced that number to 50.
Ticket.