Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melvin-chen committed Jan 14, 2025
1 parent 41fbb2d commit ee0fc16
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/nuka/src/hooks/use-paging.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,17 @@ describe('usePaging', () => {
expect(result.current.currentPage).toBe(2);
});

it('should start at index 0 if initial page is out of bounds', () => {
it('should start at in bound indices if initial page is out of bounds', () => {
const { result } = renderHook(() =>
usePaging({ totalPages: 5, wrapMode: 'wrap', initialPage: 200 }),
);
expect(result.current.currentPage).toBe(5);
});

it('should start at 0 indices if initial page is out of bounds', () => {
const { result } = renderHook(() =>
usePaging({ totalPages: 5, wrapMode: 'wrap', initialPage: -2 }),
);
expect(result.current.currentPage).toBe(0);
});
});

0 comments on commit ee0fc16

Please sign in to comment.