test: sync messaging runtime and talk expectations

This commit is contained in:
Peter Steinberger
2026-04-07 05:45:35 +01:00
parent f60c1bb9ad
commit fdacaf0853
41 changed files with 470 additions and 308 deletions

View File

@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
const loadConfigMock = vi.fn<typeof import("../../config/config.js").loadConfig>();
const applyPluginAutoEnableMock =
@@ -27,12 +27,10 @@ vi.mock("../../agents/agent-scope.js", () => ({
}));
describe("resolvePluginRuntimeLoadContext", () => {
beforeAll(async () => {
beforeEach(async () => {
vi.resetModules();
({ resolvePluginRuntimeLoadContext, buildPluginRuntimeLoadOptions } =
await import("./load-context.js"));
});
beforeEach(() => {
loadConfigMock.mockReset();
applyPluginAutoEnableMock.mockReset();
resolveAgentWorkspaceDirMock.mockClear();

View File

@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { createEmptyPluginRegistry } from "../registry.js";
const mocks = vi.hoisted(() => ({
@@ -27,6 +27,7 @@ vi.mock("../loader.js", () => ({
}));
vi.mock("../runtime.js", () => ({
getActivePluginChannelRegistry: () => null,
getActivePluginRegistry: (...args: Parameters<typeof mocks.getActivePluginRegistry>) =>
mocks.getActivePluginRegistry(...args),
}));
@@ -52,13 +53,11 @@ vi.mock("../../agents/agent-scope.js", () => ({
}));
describe("ensurePluginRegistryLoaded", () => {
beforeAll(async () => {
beforeEach(async () => {
vi.resetModules();
const mod = await import("./runtime-registry-loader.js");
ensurePluginRegistryLoaded = mod.ensurePluginRegistryLoaded;
resetPluginRegistryLoadedForTests = () => mod.__testing.resetPluginRegistryLoadedForTests();
});
beforeEach(() => {
mocks.loadOpenClawPlugins.mockReset();
mocks.getActivePluginRegistry.mockReset();
mocks.resolveConfiguredChannelPluginIds.mockReset();

View File

@@ -31,7 +31,7 @@ vi.mock("../../agents/subagent-control.js", () => ({
afterEach(() => {
resetTaskRegistryDeliveryRuntimeForTests();
resetTaskRegistryForTests();
resetTaskRegistryForTests({ persist: false });
resetTaskFlowRegistryForTests({ persist: false });
vi.clearAllMocks();
});