mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-08 15:51:06 +00:00
test: trim more command partial mocks
This commit is contained in:
@@ -23,8 +23,8 @@ const runMessageAction = vi.hoisted(() =>
|
||||
})),
|
||||
);
|
||||
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/config.js")>();
|
||||
vi.mock("../config/config.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../config/config.js")>("../config/config.js");
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: () => testConfig,
|
||||
|
||||
@@ -12,8 +12,8 @@ import { captureEnv } from "../test-utils/env.js";
|
||||
|
||||
let testConfig: Record<string, unknown> = {};
|
||||
const applyPluginAutoEnable = vi.hoisted(() => vi.fn(({ config }) => ({ config, changes: [] })));
|
||||
vi.mock("../config/config.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../config/config.js")>();
|
||||
vi.mock("../config/config.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../config/config.js")>("../config/config.js");
|
||||
return {
|
||||
...actual,
|
||||
loadConfig: () => testConfig,
|
||||
|
||||
@@ -22,8 +22,10 @@ vi.mock("../../secrets/resolve.js", () => ({
|
||||
resolveSecretRefString: resolveSecretRefStringMock,
|
||||
}));
|
||||
|
||||
vi.mock("../../agents/auth-profiles.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../../agents/auth-profiles.js")>();
|
||||
vi.mock("../../agents/auth-profiles.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../../agents/auth-profiles.js")>(
|
||||
"../../agents/auth-profiles.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
ensureAuthProfileStore: () => mockStore,
|
||||
|
||||
@@ -66,8 +66,9 @@ vi.mock("../gateway/client.js", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("./onboard-helpers.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./onboard-helpers.js")>();
|
||||
vi.mock("./onboard-helpers.js", async () => {
|
||||
const actual =
|
||||
await vi.importActual<typeof import("./onboard-helpers.js")>("./onboard-helpers.js");
|
||||
return {
|
||||
...actual,
|
||||
ensureWorkspaceAndSessions: ensureWorkspaceAndSessionsMock,
|
||||
|
||||
@@ -631,8 +631,9 @@ vi.mock("./onboard-non-interactive/local/auth-choice.plugin-providers.js", async
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("./onboard-helpers.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./onboard-helpers.js")>();
|
||||
vi.mock("./onboard-helpers.js", async () => {
|
||||
const actual =
|
||||
await vi.importActual<typeof import("./onboard-helpers.js")>("./onboard-helpers.js");
|
||||
return {
|
||||
...actual,
|
||||
ensureWorkspaceAndSessions: ensureWorkspaceAndSessionsMock,
|
||||
|
||||
@@ -10,8 +10,10 @@ const discoverGatewayBeacons = vi.hoisted(() => vi.fn<() => Promise<GatewayBonjo
|
||||
const resolveWideAreaDiscoveryDomain = vi.hoisted(() => vi.fn(() => undefined));
|
||||
const detectBinary = vi.hoisted(() => vi.fn<(name: string) => Promise<boolean>>());
|
||||
|
||||
vi.mock("../infra/bonjour-discovery.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../infra/bonjour-discovery.js")>();
|
||||
vi.mock("../infra/bonjour-discovery.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../infra/bonjour-discovery.js")>(
|
||||
"../infra/bonjour-discovery.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
discoverGatewayBeacons,
|
||||
|
||||
Reference in New Issue
Block a user