mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:17:40 +00:00
test: reuse isolated agent mock module
This commit is contained in:
@@ -1,22 +1,13 @@
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { CliDeps } from "../cli/deps.js";
|
|
||||||
import { makeCfg, makeJob, withTempCronHome } from "./isolated-agent.test-harness.js";
|
|
||||||
import type { CronJob } from "./types.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 { 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 { CliDeps } from "../cli/deps.js";
|
||||||
|
import "./isolated-agent.mocks.js";
|
||||||
import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
|
import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
|
||||||
|
import { makeCfg, makeJob, withTempCronHome } from "./isolated-agent.test-harness.js";
|
||||||
|
import type { CronJob } from "./types.js";
|
||||||
const withTempHome = withTempCronHome;
|
const withTempHome = withTempCronHome;
|
||||||
|
|
||||||
function makeDeps(): CliDeps {
|
function makeDeps(): CliDeps {
|
||||||
|
|||||||
Reference in New Issue
Block a user