perf(test): run nodes program tests on focused nodes-cli harness

This commit is contained in:
Peter Steinberger
2026-02-22 17:19:45 +00:00
parent 0e38505d3d
commit 4493f7325d
2 changed files with 28 additions and 36 deletions

View File

@@ -1,17 +1,10 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { Command } from "commander";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { createIosNodeListResponse } from "./program.nodes-test-helpers.js";
import {
callGateway,
installBaseProgramMocks,
installSmokeProgramMocks,
runTui,
runtime,
} from "./program.test-mocks.js";
import { callGateway, installBaseProgramMocks, runtime } from "./program.test-mocks.js";
installBaseProgramMocks();
installSmokeProgramMocks();
const { buildProgram } = await import("./program.js");
let registerNodesCli: (program: Command) => void;
function formatRuntimeLogCallArg(value: unknown): string {
if (typeof value === "string") {
@@ -31,14 +24,17 @@ function formatRuntimeLogCallArg(value: unknown): string {
}
describe("cli program (nodes basics)", () => {
function createProgramWithCleanRuntimeLog() {
const program = buildProgram();
runtime.log.mockClear();
return program;
}
let program: Command;
beforeAll(async () => {
({ registerNodesCli } = await import("./nodes-cli.js"));
program = new Command();
program.exitOverride();
registerNodesCli(program);
});
async function runProgram(argv: string[]) {
const program = createProgramWithCleanRuntimeLog();
runtime.log.mockClear();
await program.parseAsync(argv, { from: "user" });
}
@@ -61,7 +57,6 @@ describe("cli program (nodes basics)", () => {
beforeEach(() => {
vi.clearAllMocks();
runTui.mockResolvedValue(undefined);
});
it("runs nodes list --connected and filters to connected nodes", async () => {