diff --git a/src/ida/IdaDoctor.test.ts b/src/ida/IdaDoctor.test.ts index 7e919a463d..0851bbe5f7 100644 --- a/src/ida/IdaDoctor.test.ts +++ b/src/ida/IdaDoctor.test.ts @@ -1,4 +1,4 @@ -import { mkdtemp, readdir, rm, writeFile } from "node:fs/promises"; +import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { afterEach, expect, it } from "vitest"; @@ -16,28 +16,32 @@ afterEach(async () => { for (const root of roots.splice(0)) await rm(root, { recursive: true, force: true }); }); -it("uses the allocation normalization for readiness without creating entries", async () => { - const root = await mkdtemp(join(tmpdir(), "rea-ida-workspace-parent-")); - roots.push(root); - const path = join(root, "registration.json"); - const rawRoot = `${root}/missing/..`; - await writeFile( - path, - JSON.stringify({ - command: "python", - mode: "headless", - workspaceRoot: rawRoot, - }), - ); - const before = await readdir(root); - const inspection = await inspectIdaRegistration(path, resourceScope); - const after = await readdir(root); - expect(inspection.available).toBe(true); - expect( - inspection.checks.find(({ name }) => name === "private_workspace")?.detail, - ).toContain(rawRoot); - expect(after).toEqual(before); -}); +it.each([true, false])( + "uses allocation filesystem resolution without creating entries (traversed directory exists=%s)", + async (exists) => { + const root = await mkdtemp(join(tmpdir(), "rea-ida-workspace-parent-")); + roots.push(root); + const path = join(root, "registration.json"); + await mkdir(join(root, "existing")); + const rawRoot = exists ? `${root}/existing/..` : `${root}/missing/..`; + await writeFile( + path, + JSON.stringify({ + command: "python", + mode: "headless", + workspaceRoot: rawRoot, + }), + ); + const before = await readdir(root); + const inspection = await inspectIdaRegistration(path, resourceScope); + const after = await readdir(root); + expect(inspection.available).toBe(exists); + expect( + inspection.checks.find(({ name }) => name === "private_workspace")?.detail, + ).toContain(rawRoot); + expect(after).toEqual(before); + }, +); it("marks an unusable system temporary parent unavailable when workspaceRoot is omitted", async () => { if (process.platform === "win32") return; diff --git a/tests/boundary/cli/idaDoctorRegistration.test.ts b/tests/boundary/cli/idaDoctorRegistration.test.ts index dc3389a337..c8521a869f 100644 --- a/tests/boundary/cli/idaDoctorRegistration.test.ts +++ b/tests/boundary/cli/idaDoctorRegistration.test.ts @@ -42,9 +42,9 @@ cliTest.skipIf(process.platform !== "darwin").for([true, false])( const root = await createTestTempDirectory("rea-ida-doctor-parent-"); const parent = join(root, "parent"); await mkdir(parent); - // Keep the caller's unnormalized spelling; allocation normalizes it too. + // Keep the caller's spelling while every traversed component exists. const workspaceRoot = usable - ? `${parent}/missing/../.` + ? `${parent}/./` : join(parent, "absent"); const registration = join(root, "registration.json"); await writeFile(