Files
EpicNext-Cms/src/lib/admin-table-state.test.ts
T
Simo a070004e7b
CI / check (push) Successful in 1m5s
CI / deploy (push) Successful in 1m4s
feat(admin): reorganize housekeeping and strengthen shared workflows
2026-09-06 17:17:30 +02:00

18 lines
478 B
TypeScript

import { expect, it } from "vitest";
import { tablePageNumbers } from "./admin-table-state";
it.each([
[1, 1],
[1, 7],
[6, 7],
[7, 7],
[50, 100],
[100, 100],
])("includes the current page %i/%i and stays in bounds", (page, last) => {
const pages = tablePageNumbers(page, last);
expect(pages).toContain(page);
expect(pages.length).toBeLessThanOrEqual(5);
expect(pages.every((p) => p >= 1 && p <= last)).toBe(true);
expect(new Set(pages).size).toBe(pages.length);
});