mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-04 05:42:02 +00:00
test: speed up cli and command suites
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { probeGatewayStatus } from "./probe.js";
|
||||
|
||||
const callGatewayMock = vi.hoisted(() => vi.fn());
|
||||
const probeGatewayMock = vi.hoisted(() => vi.fn());
|
||||
@@ -15,8 +16,6 @@ vi.mock("../progress.js", () => ({
|
||||
withProgress: async (_opts: unknown, fn: () => Promise<unknown>) => await fn(),
|
||||
}));
|
||||
|
||||
const { probeGatewayStatus } = await import("./probe.js");
|
||||
|
||||
describe("probeGatewayStatus", () => {
|
||||
it("uses lightweight token-only probing for daemon status", async () => {
|
||||
callGatewayMock.mockReset();
|
||||
|
||||
@@ -2,6 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createMockGatewayService } from "../../daemon/service.test-helpers.js";
|
||||
import { captureEnv } from "../../test-utils/env.js";
|
||||
import type { GatewayRestartSnapshot } from "./restart-health.js";
|
||||
import { gatherDaemonStatus } from "./status.gather.js";
|
||||
|
||||
const callGatewayStatusProbe = vi.fn<
|
||||
(opts?: unknown) => Promise<{ ok: boolean; url?: string; error?: string | null }>
|
||||
@@ -136,8 +137,6 @@ vi.mock("./restart-health.js", () => ({
|
||||
inspectGatewayRestart: (opts: unknown) => inspectGatewayRestart(opts),
|
||||
}));
|
||||
|
||||
const { gatherDaemonStatus } = await import("./status.gather.js");
|
||||
|
||||
describe("gatherDaemonStatus", () => {
|
||||
let envSnapshot: ReturnType<typeof captureEnv>;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import { printDaemonStatus } from "./status.print.js";
|
||||
|
||||
const runtime = vi.hoisted(() => ({
|
||||
log: vi.fn<(line: string) => void>(),
|
||||
@@ -69,8 +70,6 @@ vi.mock("./status.gather.js", () => ({
|
||||
resolvePortListeningAddresses: () => ["127.0.0.1:18789"],
|
||||
}));
|
||||
|
||||
const { printDaemonStatus } = await import("./status.print.js");
|
||||
|
||||
describe("printDaemonStatus", () => {
|
||||
beforeEach(() => {
|
||||
runtime.log.mockReset();
|
||||
|
||||
Reference in New Issue
Block a user