mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 22:01:35 +00:00
perf(test): speed up dns cli test
This commit is contained in:
@@ -1,14 +1,20 @@
|
|||||||
|
import { Command } from "commander";
|
||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
const { buildProgram } = await import("./program.js");
|
const { registerDnsCli } = await import("./dns-cli.js");
|
||||||
|
|
||||||
describe("dns cli", () => {
|
describe("dns cli", () => {
|
||||||
it("prints setup info (no apply)", async () => {
|
it("prints setup info (no apply)", async () => {
|
||||||
const log = vi.spyOn(console, "log").mockImplementation(() => {});
|
const log = vi.spyOn(console, "log").mockImplementation(() => {});
|
||||||
const program = buildProgram();
|
try {
|
||||||
|
const program = new Command();
|
||||||
|
registerDnsCli(program);
|
||||||
await program.parseAsync(["dns", "setup", "--domain", "openclaw.internal"], { from: "user" });
|
await program.parseAsync(["dns", "setup", "--domain", "openclaw.internal"], { from: "user" });
|
||||||
const output = log.mock.calls.map((call) => call.join(" ")).join("\n");
|
const output = log.mock.calls.map((call) => call.join(" ")).join("\n");
|
||||||
expect(output).toContain("DNS setup");
|
expect(output).toContain("DNS setup");
|
||||||
expect(output).toContain("openclaw.internal");
|
expect(output).toContain("openclaw.internal");
|
||||||
|
} finally {
|
||||||
|
log.mockRestore();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user