- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/server/test/projected-diff.test.ts?version=211&format=json
31 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 163, 1 version changed it
You're reading version 211. The newest is 318, and no version since then changed this file.
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 reads the unpublished diff from indexed membership", (t) => {
8 const storage = memoryStorage();
9 t.after(() => storage.db.close());
10 const runtime = () => new DiskFirstRuntime(storage, "diff", "diff");
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 const result = runtime().write(
24 (c) => answer(c, "diff", "alice", {}),
25 () => {},
26 );
27 assert.equal(result.status, 200, JSON.stringify(result));
28 assert.deepEqual((result.body as { files: unknown }).files, [
29 { path: "a.txt", before: "before\n", after: "after\n" },
30 ]);
31});