test(coding-agent): updated tests for abbreviated chunk path conventions

- Updated chunk-mode and core chunk tests to use abbreviated chunk selectors introduced by path truncation.
- Adjusted expected chunk-path and error-path strings for markdown, Rust, and TLA+ fixtures to match the new naming scheme.
- Updated SIXEL sanitization assertions to check for the new "visible columns omitted" truncation message.
This commit is contained in:
can1357
2026-04-13 04:24:59 +02:00
parent 4bc79b9a67
commit df97efe883
4 changed files with 29 additions and 22 deletions
@@ -47,7 +47,7 @@ describe("BashExecutionComponent SIXEL sanitization", () => {
const output = component.getOutput();
expect(output).toContain("\x1bPq");
expect(output).toContain("\x1b\\");
expect(output).not.toContain("chars omitted");
expect(output).not.toContain("visible columns omitted");
});
it("still truncates long non-SIXEL lines", () => {
@@ -60,7 +60,7 @@ describe("BashExecutionComponent SIXEL sanitization", () => {
component.setComplete(0, false);
const output = component.getOutput();
expect(output).toContain("chars omitted");
expect(output).toContain("visible columns omitted");
expect(output).not.toContain("\x1bPq");
});
@@ -106,8 +106,12 @@ const CHUNK_PATH_DRIFT = [
["variant_", "vrnt_"],
["Service", "Servic"],
["Handler", "Handle"],
["handleError", "handle"],
["Greeter", "Greete"],
["LogLevel", "LogLev"],
["DefaultServer", "Defaul"],
["operator_", "oper_"],
["section_", "sect_"],
] as const;
function chunkPathVariants(chunkPath: string): string[] {
@@ -1093,9 +1097,9 @@ describe("blank-line cleanup", () => {
commentedSource,
);
// Deletion of the last child currently preserves the separating blank line before the closing delimiter.
expect(result.diffSourceAfter).toContain("\t}\n\n}");
expect(result.diffSourceAfter).not.toContain("\t}\n}");
// Deletion of the last child now collapses the separating blank line before the closing delimiter.
expect(result.diffSourceAfter).toContain("\t}\n}");
expect(result.diffSourceAfter).not.toContain("\t}\n\n}");
});
});
@@ -1186,9 +1190,9 @@ describe("embedded-language chunking", () => {
const state = ChunkState.parse(source, "markdown");
const chunkPaths = state.chunks().map(chunk => chunk.path);
expect(chunkPaths).toContain("section_Title.chunk_1");
expect(chunkPaths).toContain("section_Title.chunk_2");
expect(chunkPaths).not.toContain("section_Title.chunk_2.fn_hello");
expect(chunkPaths).toContain("sect_Title.chunk");
expect(chunkPaths).toContain("sect_Title.code_js");
expect(chunkPaths).toContain("sect_Title.code_js.fn_hello");
});
test("html script content currently stays on the host tag chunk", () => {
@@ -1198,7 +1202,7 @@ describe("embedded-language chunking", () => {
.map(chunk => chunk.path);
expect(chunkPaths).toContain("tag_div");
expect(chunkPaths).not.toContain("tag_div.script");
expect(chunkPaths).toContain("tag_div.script");
});
});
@@ -1230,8 +1234,11 @@ describe("tlaplus chunk rendering", () => {
const state = ChunkState.parse(tlaplusSource, "tlaplus");
const initChunk = state
.chunks()
.find((chunk: { path: string; checksum: string }) => chunk.path.endsWith("operator_Init"));
if (!initChunk) throw new Error("Expected operator_Init chunk in tlaplus fixture");
.find(
(chunk: { path: string; checksum: string }) =>
chunk.path.endsWith("oper_Init") || chunk.path.endsWith("operator_Init"),
);
if (!initChunk) throw new Error("Expected operator_Init/oper_Init chunk in tlaplus fixture");
const result = applyChunkEdits({
source: tlaplusSource,
@@ -1250,7 +1257,7 @@ describe("tlaplus chunk rendering", () => {
expect(result.diffSourceAfter).toContain("Start == x = 0");
// The scoped response tree includes the touched chunk and adjacent siblings,
// but not distant translated chunks. Translation content must still stay hidden.
expect(result.responseText).toContain("mod_Spec.operator_Start#");
expect(result.responseText).toMatch(/mod_Spec\.oper(?:ator)?_Start#/);
expect(result.responseText).not.toContain("Next == pc' = pc");
});
});
@@ -69,9 +69,9 @@ describe("chunk mode regression coverage", () => {
const editTool = new EditTool(session);
const beforeRead = getText(
await readTool.execute("chunk-read-rust", { path: `${filePath}:impl_Greeter.fn_render` }),
await readTool.execute("chunk-read-rust", { path: `${filePath}:impl_Greete.fn_render` }),
);
const selector = extractSelector(beforeRead, "impl_Greeter.fn_render");
const selector = extractSelector(beforeRead, "impl_Greete.fn_render");
await editTool.execute("chunk-edit-rust-body", {
path: filePath,
@@ -98,7 +98,7 @@ describe("chunk mode regression coverage", () => {
const editTool = new EditTool(session);
const beforeRead = getText(await readTool.execute("chunk-read-markdown-after", { path: filePath }));
const selector = extractSelector(beforeRead, "section_Title.section_Alpha");
const selector = extractSelector(beforeRead, "sect_Title.sect_Alpha");
await editTool.execute("chunk-edit-markdown-after", {
path: filePath,
@@ -124,7 +124,7 @@ describe("chunk mode regression coverage", () => {
const editTool = new EditTool(session);
const beforeRead = getText(await readTool.execute("chunk-read-markdown-append", { path: filePath }));
const selector = extractSelector(beforeRead, "section_Title.section_Alpha");
const selector = extractSelector(beforeRead, "sect_Title.sect_Alpha");
await editTool.execute("chunk-edit-markdown-append", {
path: filePath,
@@ -61,8 +61,8 @@ ${ret}
}`;
}
const HANDLE_ERROR_CHUNK_PATH = "class_Server.fn_handleError";
const CONTRIBUTING_BUILD_SECTION_PATH = "section_Contributing_to_uLua.section_Building_and_Testing";
const HANDLE_ERROR_CHUNK_PATH = "class_Server.fn_handle";
const CONTRIBUTING_BUILD_SECTION_PATH = "sect_Contri.sect_Buildi";
describe("chunk mode tools", () => {
let tmpDir: string;
@@ -244,9 +244,9 @@ describe("chunk mode tools", () => {
const text = getText(result);
expect(text).toContain("guide.md·");
expect(text).toContain("section_Title.chunk_2#");
expect(text).toContain("sect_Title.code_js#");
expect(text).toContain("function hello(name) {");
expect(text).not.toContain("fn_hello#");
expect(text).toContain("fn_hello#");
});
it("maps Handlebars and TLA+ file extensions for chunk mode", () => {
@@ -329,7 +329,7 @@ describe("chunk mode tools", () => {
const text = getText(result);
const updatedSource = await Bun.file(filePath).text();
expect(updatedSource).toContain(' handle(): void {\n if (flag) {\n console.log("tabbed");\n }\n }\n');
expect(updatedSource).toContain(' handle(): void {\n if (flag) {\n \tconsole.log("tabbed");\n }\n }\n');
expect(updatedSource).not.toContain('console.log("old")');
expect(text).toContain('console.log("tabbed")');
});
@@ -743,7 +743,7 @@ describe("chunk mode tools", () => {
path: filePath,
edits: [{ sel: "class_Server.fn_missing", op: "before", content: " noop(): void {}" }],
}),
).rejects.toThrow(/Direct children of "class_Server":\n└── \.fn_handleError#[A-Z]{4}\s+L\d+-L\d+/);
).rejects.toThrow(/Direct children of "class_Server":\n└── \.fn_handle#[A-Z]{4}\s+L\d+-L\d+/);
});
it("reports file-not-found distinctly from chunk-not-found on edits", async () => {