diff --git a/packages/mock/src/pagination.ts b/packages/mock/src/pagination.ts index 5d3c5417293..c404892fee7 100644 --- a/packages/mock/src/pagination.ts +++ b/packages/mock/src/pagination.ts @@ -158,7 +158,7 @@ export const relayStylePaginationMock = < const pageInfo: RelayPageInfo = { startCursor: edges.length > 0 ? edges[0].cursor : '', endCursor: edges.length > 0 ? edges[edges.length - 1].cursor : '', - hasNextPage: end < allEdges.length - 1, + hasNextPage: end < allEdges.length, hasPreviousPage: start > 0, }; diff --git a/packages/mock/tests/pagination.spec.ts b/packages/mock/tests/pagination.spec.ts index 23bc4582001..18d82563b4a 100644 --- a/packages/mock/tests/pagination.spec.ts +++ b/packages/mock/tests/pagination.spec.ts @@ -100,6 +100,7 @@ describe('relayStylePaginationMock', () => { }); const page2Items = page2.data?.['items'] as any; + expect(page2Items.pageInfo.hasNextPage).toBeTruthy(); expect(page2Items.edges.map((e: any) => e.node.index)).toEqual([2, 3]); const page3 = await graphql({