test: slim channel contract hotspots

This commit is contained in:
Peter Steinberger
2026-04-18 01:15:18 +01:00
parent 569247cff8
commit 3abb5fd291
22 changed files with 99 additions and 224 deletions

View File

@@ -34,7 +34,7 @@ type SlackTestApi = {
const slackPrepareTestApiModuleId = resolveRelativeBundledPluginPublicModuleId({
fromModuleUrl: import.meta.url,
pluginId: "slack",
artifactBasename: "test-api.js",
artifactBasename: "inbound-contract-test-api.js",
});
let slackTestApiPromise: Promise<SlackTestApi> | undefined;

View File

@@ -21,12 +21,12 @@ const discordOutboundAdapterModuleId = resolveRelativeBundledPluginPublicModuleI
const slackTestApiModuleId = resolveRelativeBundledPluginPublicModuleId({
fromModuleUrl: import.meta.url,
pluginId: "slack",
artifactBasename: "test-api.js",
artifactBasename: "outbound-payload-test-api.js",
});
const whatsappTestApiModuleId = resolveRelativeBundledPluginPublicModuleId({
fromModuleUrl: import.meta.url,
pluginId: "whatsapp",
artifactBasename: "test-api.js",
artifactBasename: "outbound-payload-test-api.js",
});
let discordOutboundCache: Promise<ChannelOutboundAdapter> | undefined;

View File

@@ -1,4 +1,4 @@
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { AuthProfileStore } from "../../../src/agents/auth-profiles/types.js";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { ModelDefinitionConfig } from "../../../src/config/types.models.js";
@@ -179,6 +179,7 @@ function installDiscoveryHooks(
providerIds: readonly BundledProviderUnderTest[],
) {
beforeAll(async () => {
vi.resetModules();
vi.doMock("openclaw/plugin-sdk/agent-runtime", () => {
return {
ensureAuthProfileStore: ensureAuthProfileStoreMock,
@@ -311,10 +312,13 @@ function installDiscoveryHooks(
"cloudflare-ai-gateway",
);
}
setRuntimeAuthStore();
});
beforeEach(() => {
setRuntimeAuthStore();
});
afterEach(() => {
vi.restoreAllMocks();
resolveCopilotApiTokenMock.mockReset();
buildOllamaProviderMock.mockReset();