Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 3 to 318

Compare

+36 −0 in 1 place
new file, 36 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { answer } from "../../worker/project/http.ts";
4+import { DiskFirstRuntime } from "../src/disk-first-runtime.ts";
5+import { memoryStorage } from "./helpers.ts";
6+
7+test("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+});
MCP
compare on this site's /mcp
CLI
abso diff 3 318 server/test/projected-compare.test.ts --json
JSON
/christopher/abso-core/compare/3..318?file=server%2Ftest%2Fprojected-compare.test.ts&format=json