29 lines
815 B
TypeScript
29 lines
815 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
|
|
const runCli = (args: string[]) => {
|
|
const tsxPath = path.resolve(process.cwd(), "node_modules/.bin/tsx");
|
|
const cliPath = path.resolve(process.cwd(), "src/cli/index.ts");
|
|
|
|
return spawnSync(tsxPath, [cliPath, ...args], {
|
|
encoding: "utf8",
|
|
cwd: process.cwd(),
|
|
});
|
|
};
|
|
|
|
describe("cli entry boundary behavior", () => {
|
|
test("returns non-zero for incomplete mnemonic invocation", () => {
|
|
const result = runCli(["mnemonic"]);
|
|
|
|
expect(result.status).toBe(1);
|
|
expect(result.stdout).toContain("Usage:");
|
|
});
|
|
|
|
test("returns zero for mnemonic list invocation", () => {
|
|
const result = runCli(["mnemonic", "list"]);
|
|
|
|
expect(result.status).toBe(0);
|
|
});
|
|
});
|