diff --git a/src/components/Pagination/Pagination.tsx b/src/components/Pagination/Pagination.tsx index e64cd37c6..2fa121389 100644 --- a/src/components/Pagination/Pagination.tsx +++ b/src/components/Pagination/Pagination.tsx @@ -90,7 +90,7 @@ const PaginationComponent: FC = ({ {showIcon && } {previousLabel} diff --git a/src/components/Pagination/helpers.spec.ts b/src/components/Pagination/helpers.spec.ts index 0abbf043c..e521873d5 100644 --- a/src/components/Pagination/helpers.spec.ts +++ b/src/components/Pagination/helpers.spec.ts @@ -2,12 +2,15 @@ import { describe, expect, it } from 'vitest'; import { range } from './helpers'; describe('Helpers / Range', () => { - it('should return the empty list, given start >= end', () => { + it('should return the empty list, given start > end', () => { expect(range(20, 10)).toEqual([]); - expect(range(10, 10)).toEqual([]); }); it('should return every number from start to end, inclusive, given start < end', () => { expect(range(10, 20)).toEqual([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]); }); + + it('should return a single number == start == end, given start == end', () => { + expect(range(10, 10)).toEqual([10]); + }); }); diff --git a/src/components/Pagination/helpers.ts b/src/components/Pagination/helpers.ts index 29e4a4303..4963e4c19 100644 --- a/src/components/Pagination/helpers.ts +++ b/src/components/Pagination/helpers.ts @@ -1,5 +1,5 @@ export const range: (start: number, end: number) => number[] = (start, end) => { - if (start >= end) { + if (start > end) { return []; }