test(agents): dedupe subagent registry test mocks

This commit is contained in:
Peter Steinberger
2026-02-19 09:03:37 +00:00
parent 0900ec38a9
commit 4c539f6abc
3 changed files with 17 additions and 28 deletions

View File

@@ -0,0 +1,15 @@
import { vi } from "vitest";
const noop = () => {};
vi.mock("../gateway/call.js", () => ({
callGateway: vi.fn(async () => ({
status: "ok",
startedAt: 111,
endedAt: 222,
})),
}));
vi.mock("../infra/agent-events.js", () => ({
onAgentEvent: vi.fn(() => noop),
}));

View File

@@ -1,18 +1,5 @@
import { afterEach, describe, expect, it, vi } from "vitest";
const noop = () => {};
vi.mock("../gateway/call.js", () => ({
callGateway: vi.fn(async () => ({
status: "ok",
startedAt: 111,
endedAt: 222,
})),
}));
vi.mock("../infra/agent-events.js", () => ({
onAgentEvent: vi.fn(() => noop),
}));
import "./subagent-registry.mocks.shared.js";
vi.mock("../config/config.js", () => ({
loadConfig: vi.fn(() => ({

View File

@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import "./subagent-registry.mocks.shared.js";
import { captureEnv } from "../test-utils/env.js";
import {
initSubagentRegistry,
@@ -10,20 +11,6 @@ import {
} from "./subagent-registry.js";
import { loadSubagentRegistryFromDisk } from "./subagent-registry.store.js";
const noop = () => {};
vi.mock("../gateway/call.js", () => ({
callGateway: vi.fn(async () => ({
status: "ok",
startedAt: 111,
endedAt: 222,
})),
}));
vi.mock("../infra/agent-events.js", () => ({
onAgentEvent: vi.fn(() => noop),
}));
const { announceSpy } = vi.hoisted(() => ({
announceSpy: vi.fn(async () => true),
}));