|
1 | 1 | import { describe, expect, it } from "vitest";
|
2 |
| -import { getPages } from "./QuestionsPagination"; |
| 2 | +import { getPages, QUESTIONS_PAGINATION_SEPARATOR } from "./QuestionsPagination"; |
3 | 3 |
|
4 | 4 | describe("QuestionsPagination", () => {
|
| 5 | + // prettier-ignore |
5 | 6 | it.each([
|
6 |
| - { first: 1, last: 6, current: 1, expected: [1, 2, 3, 4, 6] }, |
7 |
| - { first: 1, last: 6, current: 2, expected: [1, 2, 3, 4, 6] }, |
8 |
| - { first: 1, last: 6, current: 3, expected: [1, 2, 3, 4, 6] }, |
9 |
| - { first: 1, last: 6, current: 4, expected: [1, 3, 4, 5, 6] }, |
10 |
| - { first: 1, last: 7, current: 5, expected: [1, 4, 5, 6, 7] }, |
| 7 | + { first: 1, last: 6, current: 1, expected: [1, 2, 3, 4, QUESTIONS_PAGINATION_SEPARATOR, 6] }, |
| 8 | + { first: 1, last: 6, current: 2, expected: [1, 2, 3, 4, QUESTIONS_PAGINATION_SEPARATOR, 6] }, |
| 9 | + { first: 1, last: 6, current: 3, expected: [1, 2, 3, 4, QUESTIONS_PAGINATION_SEPARATOR, 6] }, |
| 10 | + { first: 1, last: 6, current: 4, expected: [1, QUESTIONS_PAGINATION_SEPARATOR, 3, 4, 5, 6] }, |
| 11 | + { first: 1, last: 7, current: 5, expected: [1, QUESTIONS_PAGINATION_SEPARATOR, 4, 5, 6, 7] }, |
11 | 12 | { first: 1, last: 5, current: 3, expected: [1, 2, 3, 4, 5] },
|
12 | 13 | { first: 1, last: 5, current: 4, expected: [1, 2, 3, 4, 5] },
|
13 | 14 | { first: 1, last: 5, current: 5, expected: [1, 2, 3, 4, 5] },
|
14 |
| - { first: 1, last: 871, current: 412, expected: [1, 411, 412, 413, 871] }, |
15 |
| - { first: 1, last: 872, current: 313, expected: [1, 312, 313, 314, 872] }, |
16 |
| - { first: 1, last: 872, current: 2, expected: [1, 2, 3, 4, 872] }, |
17 |
| - { first: 1, last: 872, current: 871, expected: [1, 869, 870, 871, 872] }, |
| 15 | + { first: 1, last: 871, current: 412, expected: [1, QUESTIONS_PAGINATION_SEPARATOR, 411, 412, 413, QUESTIONS_PAGINATION_SEPARATOR, 871] }, |
| 16 | + { first: 1, last: 872, current: 313, expected: [1, QUESTIONS_PAGINATION_SEPARATOR, 312, 313, 314, QUESTIONS_PAGINATION_SEPARATOR, 872] }, |
| 17 | + { first: 1, last: 872, current: 2, expected: [1, 2, 3, 4, QUESTIONS_PAGINATION_SEPARATOR, 872] }, |
| 18 | + { first: 1, last: 872, current: 871, expected: [1, QUESTIONS_PAGINATION_SEPARATOR, 869, 870, 871, 872] }, |
18 | 19 | { first: 1, last: 1, current: 1, expected: [1] },
|
19 | 20 | { first: 1, last: 2, current: 1, expected: [1, 2] },
|
20 | 21 | { first: 1, last: 2, current: 2, expected: [1, 2] },
|
|
0 commit comments