mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 05:31:30 +00:00
test: trim more extension partial mocks
This commit is contained in:
@@ -35,8 +35,10 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", () => ({
|
||||
dispatchReplyWithBufferedBlockDispatcher: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("openclaw/plugin-sdk/runtime-env", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/runtime-env")>();
|
||||
vi.mock("openclaw/plugin-sdk/runtime-env", async () => {
|
||||
const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/runtime-env")>(
|
||||
"openclaw/plugin-sdk/runtime-env",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
danger: (value: unknown) => String(value),
|
||||
|
||||
@@ -36,8 +36,8 @@ vi.mock("ajv", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("../api.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../api.js")>();
|
||||
vi.mock("../api.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../api.js")>("../api.js");
|
||||
return {
|
||||
...actual,
|
||||
resolvePreferredOpenClawTmpDir: () => "/tmp",
|
||||
|
||||
@@ -18,8 +18,8 @@ const spawnState = vi.hoisted(() => ({
|
||||
spawn: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("node:child_process", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("node:child_process")>();
|
||||
vi.mock("node:child_process", async () => {
|
||||
const actual = await vi.importActual<typeof import("node:child_process")>("node:child_process");
|
||||
return {
|
||||
...actual,
|
||||
spawn: (...args: unknown[]) => spawnState.spawn(...args),
|
||||
|
||||
@@ -5,8 +5,8 @@ const cliMocks = vi.hoisted(() => ({
|
||||
registerMatrixCli: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("./src/cli.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./src/cli.js")>();
|
||||
vi.mock("./src/cli.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("./src/cli.js")>("./src/cli.js");
|
||||
return {
|
||||
...actual,
|
||||
registerMatrixCli: cliMocks.registerMatrixCli,
|
||||
|
||||
@@ -11,8 +11,10 @@ import {
|
||||
runMatrixDoctorSequence,
|
||||
} from "./doctor.js";
|
||||
|
||||
vi.mock("./matrix-migration.runtime.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("./matrix-migration.runtime.js")>();
|
||||
vi.mock("./matrix-migration.runtime.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("./matrix-migration.runtime.js")>(
|
||||
"./matrix-migration.runtime.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
hasActionableMatrixMigration: vi.fn(() => false),
|
||||
|
||||
@@ -32,8 +32,10 @@ const maybeCreateMatrixMigrationSnapshotMock = vi.hoisted(() =>
|
||||
})),
|
||||
);
|
||||
|
||||
vi.mock("../../../../../src/infra/backup-create.js", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("../../../../../src/infra/backup-create.js")>();
|
||||
vi.mock("../../../../../src/infra/backup-create.js", async () => {
|
||||
const actual = await vi.importActual<typeof import("../../../../../src/infra/backup-create.js")>(
|
||||
"../../../../../src/infra/backup-create.js",
|
||||
);
|
||||
return {
|
||||
...actual,
|
||||
createBackupArchive: (params: unknown) => createBackupArchiveMock(params),
|
||||
|
||||
Reference in New Issue
Block a user