mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:51:23 +00:00
test(agent): reuse isolated agent mock setup
This commit is contained in:
@@ -1,19 +1,10 @@
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { beforeEach, describe, expect, it, type MockInstance, vi } from "vitest";
|
import { beforeEach, describe, expect, it, type MockInstance, vi } from "vitest";
|
||||||
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
|
|
||||||
|
|
||||||
vi.mock("../agents/pi-embedded.js", () => ({
|
|
||||||
abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
|
|
||||||
runEmbeddedPiAgent: vi.fn(),
|
|
||||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
|
||||||
}));
|
|
||||||
vi.mock("../agents/model-catalog.js", () => ({
|
|
||||||
loadModelCatalog: vi.fn(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
import { telegramPlugin } from "../../extensions/telegram/src/channel.js";
|
import { telegramPlugin } from "../../extensions/telegram/src/channel.js";
|
||||||
|
import "../cron/isolated-agent.mocks.js";
|
||||||
import { setTelegramRuntime } from "../../extensions/telegram/src/runtime.js";
|
import { setTelegramRuntime } from "../../extensions/telegram/src/runtime.js";
|
||||||
|
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
|
||||||
import { loadModelCatalog } from "../agents/model-catalog.js";
|
import { loadModelCatalog } from "../agents/model-catalog.js";
|
||||||
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
||||||
import type { OpenClawConfig } from "../config/config.js";
|
import type { OpenClawConfig } from "../config/config.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user