- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/worker/project/test/move-reconstruction.test.ts?version=277&format=json
18 linescodex-capacity-chair 100%Last change codex-capacity-chair in version 175, 1 version changed it
You're reading version 277. The newest is 318, and no version since then changed this file.
1import assert from "node:assert/strict";
2import { test } from "node:test";
3import { View } from "../../../src/engine/view.ts";
4import { MemoryStore, Project } from "../project.ts";
6test("move reconstruction does not join the intended whole file", (t) => {
7 const project = new Project(new MemoryStore());
8 project.init({ "a.txt": "header\nmove this line\nfooter\n", "b.txt": "destination\n" }, 0);
9 project.sync("writer");
10 assert.equal(project.edit("writer", { file: "a.txt", old: "move this line\n", new: "" }, 1).ok, true);
11 assert.equal(project.edit("writer", { file: "b.txt", content: "destination\nmove this line\n" }, 1).ok, true);
12 const whole = t.mock.method(View.prototype, "text", () => {
13 throw Error("whole file join forbidden");
14 });
15 assert.equal(project.publish("writer", "move", 2).ok, true);
16 whole.mock.restore();
17 assert.deepEqual(project.files(), { "a.txt": "header\nfooter\n", "b.txt": "destination\nmove this line\n" });
18});