- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/server/test/projected-compare.test.ts?format=json
36 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 163, 1 version changed it
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { answer } from "../../worker/project/http.ts";
4import { DiskFirstRuntime } from "../src/disk-first-runtime.ts";
5import { memoryStorage } from "./helpers.ts";
7test("disk runtime compares published versions through indexed views", (t) => {
8 const storage = memoryStorage();
9 t.after(() => storage.db.close());
10 const runtime = () => new DiskFirstRuntime(storage, "compare", "compare");
11 runtime().initialize(
12 (c) => answer(c, "init", undefined, { files: { "a.txt": "before\n" } }),
13 () => {},
14 );
15 while (!runtime().preparePage(() => {}).ready) {}
16 assert.equal(
17 runtime().write(
18 (c) => answer(c, "record", "alice", { files: { "a.txt": "after\n" } }),
19 () => {},
20 ).status,
21 200,
22 );
23 assert.equal(
24 runtime().write(
25 (c) => answer(c, "publish", "alice", { message: "change" }),
26 () => {},
27 ).status,
28 200,
29 );
30 const result = runtime().read(
31 (c) => answer(c, "compare", undefined, { from: 0, to: 1 }),
32 () => {},
33 );
34 assert.equal(result.status, 200, JSON.stringify(result));
35 assert.equal((result.body as { files: unknown[] }).files.length, 1);
36});