mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
Add a test for pagination
This commit is contained in:
parent
103b995c32
commit
590a5b40fb
@ -128,6 +128,7 @@ describe('Scim', () => {
|
||||
}
|
||||
return axios[method](scimUrl(path), validBody, USER_CONFIG_BY_NAME[user]);
|
||||
}
|
||||
|
||||
it('should return 401 for anonymous', async function () {
|
||||
const res = await makeCallWith('anon');
|
||||
assert.equal(res.status, 401);
|
||||
@ -245,6 +246,25 @@ describe('Scim', () => {
|
||||
assert.deepInclude(res.data.Resources, personaToSCIMMYUserWithId('kiwi'));
|
||||
});
|
||||
|
||||
it('should handle pagination', async function () {
|
||||
const endpointPaginated = '/Users?count=1&sortBy=id';
|
||||
{
|
||||
const firstPage = await axios.get(scimUrl(endpointPaginated), chimpy);
|
||||
assert.equal(firstPage.status, 200);
|
||||
assert.lengthOf(firstPage.data.Resources, 1);
|
||||
const firstPageResourceId = parseInt(firstPage.data.Resources[0].id);
|
||||
assert.equal(firstPageResourceId, 1);
|
||||
}
|
||||
|
||||
{
|
||||
const secondPage = await axios.get(scimUrl(endpointPaginated + '&startIndex=2'), chimpy);
|
||||
assert.equal(secondPage.status, 200);
|
||||
assert.lengthOf(secondPage.data.Resources, 1);
|
||||
const secondPageResourceId = parseInt(secondPage.data.Resources[0].id);
|
||||
assert.equal(secondPageResourceId, 2);
|
||||
}
|
||||
});
|
||||
|
||||
checkCommonErrors('get', '/Users');
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user