Skip to content

Commit

Permalink
Set limit on first page
Browse files Browse the repository at this point in the history
  • Loading branch information
nalanj committed Dec 17, 2024
1 parent f25e8ca commit 1e20715
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ class NangoActionMock {
const paginateInBody = ['post', 'put', 'patch'].includes(args.method.toLowerCase());
const updatedBodyOrParams = paginateInBody ? (args.data as Record<string, any>) || {} : args.params || {};

if (args.paginate['limit']) {
const limitParameterName = args.paginate.limit_name_in_request;
if (!limitParameterName) {
throw new Error('limit_name_in_request is required when using pagination');

Check failure on line 134 in vitest.setup.ts

View workflow job for this annotation

GitHub Actions / tests (ubuntu-latest, 20.x)

integrations/front/tests/front-conversation.test.ts > front conversation tests > should output the action output that is expected

Error: limit_name_in_request is required when using pagination ❯ NangoActionMock.getProxyPaginateData vitest.setup.ts:134:23 ❯ Module.runAction [as default] integrations/front/actions/conversation.ts:19:22 ❯ integrations/front/tests/front-conversation.test.ts:14:32
}

updatedBodyOrParams[limitParameterName] = args.paginate['limit'];
}

if (args.paginate?.type === 'cursor') {
yield* this.cursorPaginate(args, updatedBodyOrParams, paginateInBody);
} else if (args.paginate?.type === 'link') {
Expand Down

0 comments on commit 1e20715

Please sign in to comment.