From add170add0a4fcf048afd2ab95e3e1ce8a489955 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 21:59:35 +0000 Subject: [PATCH] perf(test): speed up dns cli test --- src/cli/dns-cli.test.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cli/dns-cli.test.ts b/src/cli/dns-cli.test.ts index 4ab49c869..69d63dd28 100644 --- a/src/cli/dns-cli.test.ts +++ b/src/cli/dns-cli.test.ts @@ -1,14 +1,20 @@ +import { Command } from "commander"; import { describe, expect, it, vi } from "vitest"; -const { buildProgram } = await import("./program.js"); +const { registerDnsCli } = await import("./dns-cli.js"); describe("dns cli", () => { it("prints setup info (no apply)", async () => { const log = vi.spyOn(console, "log").mockImplementation(() => {}); - const program = buildProgram(); - await program.parseAsync(["dns", "setup", "--domain", "openclaw.internal"], { from: "user" }); - const output = log.mock.calls.map((call) => call.join(" ")).join("\n"); - expect(output).toContain("DNS setup"); - expect(output).toContain("openclaw.internal"); + try { + const program = new Command(); + registerDnsCli(program); + await program.parseAsync(["dns", "setup", "--domain", "openclaw.internal"], { from: "user" }); + const output = log.mock.calls.map((call) => call.join(" ")).join("\n"); + expect(output).toContain("DNS setup"); + expect(output).toContain("openclaw.internal"); + } finally { + log.mockRestore(); + } }); });