Expose project revision timeline

This commit is contained in:
2026-07-25 21:57:03 +02:00
parent 4b47bc2bcc
commit 5a0c9019af
14 changed files with 365 additions and 8 deletions
+38
View File
@@ -0,0 +1,38 @@
import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { listProjectRevisionsQuerySchema } from "../src/shared/validation/project-history.schemas.js";
describe("project revision timeline query", () => {
it("applies a bounded default page size", () => {
assert.deepEqual(
listProjectRevisionsQuerySchema.parse({}),
{ limit: 25 }
);
assert.deepEqual(
listProjectRevisionsQuerySchema.parse({
limit: "100",
beforeRevision: "42",
}),
{
limit: 100,
beforeRevision: 42,
}
);
});
it("rejects invalid cursors, page sizes and unknown query fields", () => {
for (const query of [
{ limit: "0" },
{ limit: "101" },
{ limit: "1.5" },
{ beforeRevision: "0" },
{ beforeRevision: "not-a-number" },
{ unexpected: "value" },
]) {
assert.equal(
listProjectRevisionsQuerySchema.safeParse(query).success,
false
);
}
});
});