Files
reverse-engineering-anything/tests/boundary/cli/searchBytesAdmission.test.ts
T
Matt Van Hornandgensokyo-dev e9c72dbd1f feat(elf): inspect dynamic dependencies and required symbol versions
Add offline ELF dependency, search-path, symbol-version and import inspection with retained Evidence summaries and pages. Bound GNU-hash work and preserve cancellation, stable identity and caller-selected parameters across CLI/MCP.

Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-17 08:19:52 +00:00

67 lines
1.6 KiB
TypeScript

import { createCommandCli } from "../../support/cli/commandCli.js";
import pino from "pino";
import { expect, it, vi } from "vitest";
import { registerCoreNativeCommands } from "../../../src/cli/coreNativeCommands.js";
const registry = () => {
const run = vi.fn(async () => ({
ok: false as const,
error: { code: "invalid_request", message: "Admitted query control" },
}));
const cli = createCommandCli();
registerCoreNativeCommands(cli, pino({ enabled: false }), run);
return { cli, run };
};
it("forwards admitted original strings and caller-selected search/provider controls", async () => {
const { cli, run } = registry();
await cli.serve(
[
"search-bytes",
"/selected",
"ab ?? CD",
"--mask",
"FF 00 ff",
"--start",
"0x10",
"--end",
"0x20",
"--cursor",
"next",
"--limit",
"7",
"--provider",
"ghidra",
"--json",
],
{ stdout: () => undefined, exit: () => undefined },
);
expect(run).toHaveBeenCalledExactlyOnceWith(
"/selected",
"search_bytes",
{
pattern: "ab ?? CD",
mask: "FF 00 ff",
start: "0x10",
end: "0x20",
cursor: "next",
limit: 7,
},
expect.objectContaining({ providerId: "ghidra" }),
);
});
it("keeps omitted mask and limit selections omitted", async () => {
const { cli, run } = registry();
await cli.serve(["search-bytes", "/selected", "AB", "--json"], {
stdout: () => undefined,
exit: () => undefined,
});
expect(run).toHaveBeenCalledExactlyOnceWith(
"/selected",
"search_bytes",
{ pattern: "AB" },
expect.any(Object),
);
});