refactor(native): bound nested path checks and verify real ticket coverage

This commit is contained in:
morluto
2026-10-08 19:35:56 +08:00
parent 670b657d0e
commit 38e2a342d1
6 changed files with 162 additions and 87 deletions
+27
View File
@@ -0,0 +1,27 @@
import { expect, it } from "vitest";
import { unconfirmedNestedCode } from "./NativeNestedCode.js";
it("observes cancellation between nested filesystem lookups", async () => {
const controller = new AbortController();
const paths: string[] = [];
await expect(
unconfirmedNestedCode(
{
path: "/app",
status: "valid",
exit_code: 0,
diagnostics: [],
validated_nested_code: ["/app/first", "/app/second"],
},
controller.signal,
{
lookup: async (path) => {
paths.push(path);
controller.abort();
},
names: async () => [],
},
),
).rejects.toMatchObject({ name: "AbortError" });
expect(paths).toEqual(["/app/first"]);
});