mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 06:30:21 +00:00
test: speed up cli and model command suites
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
|
||||
const callGateway = vi.fn();
|
||||
@@ -18,9 +18,12 @@ vi.mock("../utils/message-channel.js", () => ({
|
||||
|
||||
let resolveCommandSecretRefsViaGateway: typeof import("./command-secret-gateway.js").resolveCommandSecretRefsViaGateway;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ resolveCommandSecretRefsViaGateway } = await import("./command-secret-gateway.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
callGateway.mockReset();
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const listChannelPairingRequests = vi.fn();
|
||||
const approveChannelPairingCode = vi.fn();
|
||||
@@ -47,9 +47,12 @@ vi.mock("../config/config.js", () => ({
|
||||
describe("pairing cli", () => {
|
||||
let registerPairingCli: typeof import("./pairing-cli.js").registerPairingCli;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
vi.resetModules();
|
||||
({ registerPairingCli } = await import("./pairing-cli.js"));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
listChannelPairingRequests.mockClear();
|
||||
listChannelPairingRequests.mockResolvedValue([]);
|
||||
approveChannelPairingCode.mockClear();
|
||||
|
||||
Reference in New Issue
Block a user