Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { clampLimit, decodeCursor, encodeCursor } from "./pagination.js";
|
||||
|
||||
describe("MCP pagination", () => {
|
||||
it("clamps limits to a safe page size", () => {
|
||||
expect(clampLimit(undefined)).toBe(20);
|
||||
expect(clampLimit(-1)).toBe(20);
|
||||
expect(clampLimit(500)).toBe(50);
|
||||
expect(clampLimit(12)).toBe(12);
|
||||
});
|
||||
|
||||
it("round-trips opaque cursors and rejects invalid values", () => {
|
||||
const cursor = { id: "lead_1", createdAt: "2026-07-03T10:00:00.000Z" };
|
||||
expect(decodeCursor(encodeCursor(cursor))).toEqual(cursor);
|
||||
expect(decodeCursor("not-a-cursor")).toBeNull();
|
||||
expect(decodeCursor(Buffer.from(JSON.stringify({ id: 1, createdAt: "x" })).toString("base64url"))).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user