From b55898d50d38b866167063ff1a33c3e00eaccd50 Mon Sep 17 00:00:00 2001 From: ppetzold Date: Wed, 22 Mar 2023 22:04:46 +0100 Subject: [PATCH] add query limit test case --- src/paginate.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/paginate.spec.ts b/src/paginate.spec.ts index 869237b..48dd67c 100644 --- a/src/paginate.spec.ts +++ b/src/paginate.spec.ts @@ -278,6 +278,22 @@ describe('paginate', () => { expect(result.data).toStrictEqual(cats.slice(0, 2)) }) + it('should limit cats by query', async () => { + const config: PaginateConfig = { + sortableColumns: ['id'], + maxLimit: Number.MAX_SAFE_INTEGER, + defaultLimit: Number.MAX_SAFE_INTEGER, + } + const query: PaginateQuery = { + path: '', + limit: 2, + } + + const result = await paginate(query, catRepo, config) + + expect(result.data).toStrictEqual(cats.slice(0, 2)) + }) + it('should return correct links for some results', async () => { const config: PaginateConfig = { sortableColumns: ['id'],