mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 09:56:23 +00:00
* refactor(tests): consolidate repeated CLI capture and fixture construction * test(cli): keep overlapping schema and help cases in their existing PR
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { createCommandCli } from "../../support/cli/commandCli.js";
|
|
import { expect, it } from "vitest";
|
|
import { serveInProcessCli } from "../../support/cli/serveInProcessCli.js";
|
|
import { registerElectronCommands } from "../../../src/cli/electronCommands.js";
|
|
import { silentLogger } from "../../../src/logger.js";
|
|
|
|
const serve = async (argv: readonly string[]): Promise<unknown> => {
|
|
const cli = createCommandCli();
|
|
registerElectronCommands(cli, silentLogger, {});
|
|
const { stdout } = await serveInProcessCli(cli, [...argv, "--json"]);
|
|
return JSON.parse(stdout);
|
|
};
|
|
|
|
it("rejects an empty or NUL analyze-javascript-application path before analysis", async () => {
|
|
expect(await serve(["analyze-javascript-application", ""])).toMatchObject({
|
|
code: "VALIDATION_ERROR",
|
|
fieldErrors: [expect.objectContaining({ path: "path", code: "too_small" })],
|
|
});
|
|
expect(
|
|
await serve(["analyze-javascript-application", "target\x00name"]),
|
|
).toMatchObject({
|
|
code: "VALIDATION_ERROR",
|
|
fieldErrors: [
|
|
expect.objectContaining({ path: "path", code: "invalid_format" }),
|
|
],
|
|
});
|
|
});
|