add query limit test case
This commit is contained in:
parent
e8705e205b
commit
b55898d50d
@ -278,6 +278,22 @@ describe('paginate', () => {
|
|||||||
expect(result.data).toStrictEqual(cats.slice(0, 2))
|
expect(result.data).toStrictEqual(cats.slice(0, 2))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should limit cats by query', async () => {
|
||||||
|
const config: PaginateConfig<CatEntity> = {
|
||||||
|
sortableColumns: ['id'],
|
||||||
|
maxLimit: Number.MAX_SAFE_INTEGER,
|
||||||
|
defaultLimit: Number.MAX_SAFE_INTEGER,
|
||||||
|
}
|
||||||
|
const query: PaginateQuery = {
|
||||||
|
path: '',
|
||||||
|
limit: 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await paginate<CatEntity>(query, catRepo, config)
|
||||||
|
|
||||||
|
expect(result.data).toStrictEqual(cats.slice(0, 2))
|
||||||
|
})
|
||||||
|
|
||||||
it('should return correct links for some results', async () => {
|
it('should return correct links for some results', async () => {
|
||||||
const config: PaginateConfig<CatEntity> = {
|
const config: PaginateConfig<CatEntity> = {
|
||||||
sortableColumns: ['id'],
|
sortableColumns: ['id'],
|
||||||
|
Loading…
Reference in New Issue
Block a user