Files
reverse-engineering-anything/tests/boundary/cli/objdumpIdentity.test.ts
T
morluto 42e808ff76 test: expect the unknown Evidence subject for resource-only and objdump command records (#11613)
Since #11416 every Evidence record has a subject; one without a file
target names identity {kind: unknown, reason: not-observed} with null name
and local_path. Four tests that #11416's run did not select still expected
subject: null and fail on main: the keyless bundle resource CLI, provider
composition and acceptance tests, and the objdump command identity test.
2026-11-16 08:25:18 +08:00

77 lines
2.0 KiB
TypeScript

import { unknownTarget } from "../../../src/domain/targetIdentity.js";
import { expect } from "vitest";
import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { cliTest } from "../../support/cli/cliFixture.js";
cliTest(
"does not attribute a caller-selected command to GNU objdump",
async ({ cli }) => {
const result = await cli.run({
arguments: [
"inspect-with-objdump",
process.execPath,
"file_headers",
"--format",
"json",
],
environment: { REA_OBJDUMP_COMMAND: process.execPath },
});
expect(result.exitCode).toBe(0);
expect(result.json).toMatchObject({
provider: {
id: "objdump.command",
name: "objdump command",
version: null,
},
parameters: { provider_executable: process.execPath },
normalized_result: {
exit_code: expect.any(Number),
completion_status: "complete",
},
});
const architectures = await cli.run({
arguments: ["list-objdump-architectures", "--format", "json"],
environment: { REA_OBJDUMP_COMMAND: process.execPath },
input: "",
});
expect(architectures.exitCode).toBe(0);
expect(architectures.json).toMatchObject({
provider: {
id: "objdump.command",
name: "objdump command",
version: null,
},
subject: {
identity: unknownTarget("not-observed"),
name: null,
local_path: null,
},
});
const missing = join(tmpdir(), `missing-objdump-${randomUUID()}`);
const failed = await cli.run({
arguments: [
"inspect-with-objdump",
process.execPath,
"file_headers",
"--format",
"json",
],
environment: { REA_OBJDUMP_COMMAND: missing },
});
expect(failed.exitCode).toBe(1);
expect(failed.json).toMatchObject({
code: "capability_unavailable",
details: {
provider_id: "objdump.command",
diagnostics: { command: missing },
},
});
},
);