The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/data/utils.ts

28 lines
849 B

import type { Credentials } from '@rocket.chat/api-client';
import type { Path } from '@rocket.chat/rest-typings';
import { expect } from 'chai';
import { api, request, type PathWithoutPrefix } from './api-data';
export const pagination = <TPath extends PathWithoutPrefix<Path>>(
apiEndpoint: TPath,
credentials: Credentials,
extraQueryParams: Record<string, any> = {},
) => {
return request
.get(api(apiEndpoint))
.set(credentials)
.query({
...extraQueryParams,
count: 10,
offset: 1,
sort: JSON.stringify({ _updatedAt: -1 }),
})
.expect('content-type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('count').that.is.a('number');
expect(res.body).to.have.property('offset').that.is.a('number');
expect(res.body).to.have.property('total').that.is.a('number');
});
};