mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
test: use independent diagnostics and filesystem oracles
This commit is contained in:
1 parent
b899c35419
commit
25f50eea02
4 files changed
+17
-32
No files matched your search
@@ -389,7 +389,7 @@ const providerSettingSelections = (
|
||||
];
|
||||
|
||||
/** Render what the registration comparison established without inferring its effective environment. */
|
||||
export const registrationEnvironmentDetail = (
|
||||
const registrationEnvironmentDetail = (
|
||||
client: string,
|
||||
{
|
||||
unrecorded,
|
||||
|
||||
@@ -4,12 +4,7 @@ import { expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../tests/fixtures/temporaryDirectory.js";
|
||||
import { createDoctorHostFixture as host } from "./Doctor.fixture.js";
|
||||
import {
|
||||
registrationEnvironmentDetail,
|
||||
runDoctor,
|
||||
systemDoctorHost,
|
||||
type DoctorHost,
|
||||
} from "./Doctor.js";
|
||||
import { runDoctor, systemDoctorHost, type DoctorHost } from "./Doctor.js";
|
||||
|
||||
const inspection = (
|
||||
id: string,
|
||||
@@ -186,11 +181,12 @@ it("states each comparison result without a claim it did not establish", async (
|
||||
classification: "unknown",
|
||||
details: { effective_environment: "unknown" },
|
||||
});
|
||||
expect(check?.detail).toBe(
|
||||
registrationEnvironmentDetail("cursor", {
|
||||
unrecorded: [],
|
||||
differing: ["JAVA_HOME"],
|
||||
unresolved: ["GHIDRA_INSTALL_DIR"],
|
||||
}),
|
||||
expect(check?.detail).toContain(
|
||||
"what the server cursor starts receives is unknown",
|
||||
);
|
||||
expect(check?.detail).toContain("It records other values for JAVA_HOME.");
|
||||
expect(check?.detail).toContain(
|
||||
"REA could not resolve its GHIDRA_INSTALL_DIR.",
|
||||
);
|
||||
expect(check?.detail).not.toContain("does not record");
|
||||
});
|
||||
@@ -1010,7 +1010,7 @@ describe("decompile_all partial results", () => {
|
||||
if (!result.ok)
|
||||
expect(result.error.userMessage).toContain("before address start");
|
||||
expect(calls).toHaveLength(0);
|
||||
await expect(readFile(directory())).rejects.toThrow();
|
||||
await expect(stat(directory())).rejects.toMatchObject({ code: "ENOENT" });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -71,30 +71,19 @@ it("resolves a Windows executable through the canonical PATH spelling", async ()
|
||||
await mkdir(selected);
|
||||
await mkdir(ambient);
|
||||
await writeFile(join(selected, "tool.exe"), "");
|
||||
await chmod(join(selected, "tool.exe"), 0o644);
|
||||
await chmod(join(selected, "tool.exe"), 0o755);
|
||||
const scenario = processScenarioSchema.parse({
|
||||
executable: "tool.exe",
|
||||
working_directory: root,
|
||||
environment: { Path: selected },
|
||||
});
|
||||
const candidate = join(selected, "tool.exe");
|
||||
try {
|
||||
const resolved = await resolveProcessScenarioRuntimePaths(
|
||||
scenario,
|
||||
{ PATH: ambient },
|
||||
"win32",
|
||||
);
|
||||
expect(resolved.executable).toBe(candidate);
|
||||
} catch (cause: unknown) {
|
||||
const message =
|
||||
cause instanceof AnalysisInputError
|
||||
? (cause.issues[0]?.message ?? cause.message)
|
||||
: cause instanceof Error
|
||||
? cause.message
|
||||
: String(cause);
|
||||
expect(message).toContain(candidate);
|
||||
expect(message).not.toContain(ambient);
|
||||
}
|
||||
const resolved = await resolveProcessScenarioRuntimePaths(
|
||||
scenario,
|
||||
{ PATH: ambient },
|
||||
"win32",
|
||||
);
|
||||
expect(resolved.executable).toBe(candidate);
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user