feat: add cursor-based message queries

This commit is contained in:
MythEclipse
2026-05-14 18:48:02 +07:00
parent 8ab7aaa32d
commit 9f5f8a3090
2 changed files with 147 additions and 2 deletions
@@ -0,0 +1,13 @@
import { describe, expect, it } from "vitest";
import { decodeCursor, encodeCursor } from "../../src/moderation/messageStore";
describe("message cursor helpers", () => {
it("round-trips created_at and id", () => {
const cursor = encodeCursor({ created_at: 1710000000000, id: "abc" });
expect(decodeCursor(cursor)).toEqual({ created_at: 1710000000000, id: "abc" });
});
it("returns null for invalid cursor", () => {
expect(decodeCursor("not-base64-json")).toBeNull();
});
});