Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+25
-1
@@ -1,11 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import Constants from "~/application/Constants";
|
||||
import { getPaginationFromCurrentUrl } from "./RowPaginationHelper";
|
||||
import { getPaginationFromCurrentUrl, getTotalPages } from "./RowPaginationHelper";
|
||||
|
||||
function paginationFor(query: string) {
|
||||
return getPaginationFromCurrentUrl(new URLSearchParams(query));
|
||||
}
|
||||
|
||||
describe("getTotalPages", () => {
|
||||
it("never renders NaN when an upstream provider reports no page size", () => {
|
||||
// Regression guard for the admin notification tables, which showed "1/NAN"
|
||||
// whenever the provider call returned nothing (0 / 0).
|
||||
expect(getTotalPages(0, 0)).toBe(1);
|
||||
expect(getTotalPages(undefined, undefined)).toBe(1);
|
||||
expect(getTotalPages(null, null)).toBe(1);
|
||||
expect(getTotalPages(Number.NaN, Number.NaN)).toBe(1);
|
||||
});
|
||||
|
||||
it("keeps at least one page for an empty result set", () => {
|
||||
expect(getTotalPages(0, 10)).toBe(1);
|
||||
});
|
||||
|
||||
it("rounds partial pages up", () => {
|
||||
expect(getTotalPages(41, 10)).toBe(5);
|
||||
expect(getTotalPages(40, 10)).toBe(4);
|
||||
});
|
||||
|
||||
it("falls back to the default page size for non-positive sizes", () => {
|
||||
expect(getTotalPages(25, -5)).toBe(Math.ceil(25 / Constants.DEFAULT_PAGE_SIZE));
|
||||
});
|
||||
});
|
||||
|
||||
describe("RowPaginationHelper", () => {
|
||||
it("defaults invalid pagination params before they reach database queries", () => {
|
||||
expect(paginationFor("page=abc&pageSize=abc")).toMatchObject({
|
||||
|
||||
Reference in new issue
Block a user