perf(test): flatten async channel secret mocks

This commit is contained in:
Vincent Koc
2026-04-06 17:24:28 +01:00
parent 5f906c926d
commit 6dc3e1f770
8 changed files with 16 additions and 17 deletions

View File

@@ -1,11 +1,11 @@
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import * as discordSecrets from "../../extensions/discord/src/secret-config-contract.ts";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const discordSecrets = await import("../../extensions/discord/src/secret-config-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "discord"

View File

@@ -1,10 +1,10 @@
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import * as telegramSecrets from "../../extensions/telegram/src/secret-contract.ts";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const telegramSecrets = await import("../../extensions/telegram/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "telegram"

View File

@@ -1,4 +1,5 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import * as telegramSecrets from "../../extensions/telegram/src/secret-contract.ts";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
@@ -14,8 +15,7 @@ vi.mock("../plugins/web-search-providers.runtime.js", () => ({
resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
}));
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const telegramSecrets = await import("../../extensions/telegram/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "telegram"

View File

@@ -1,4 +1,5 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import * as matrixSecrets from "../../extensions/matrix/src/secret-contract.ts";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
@@ -15,8 +16,7 @@ vi.mock("../plugins/web-search-providers.runtime.js", () => ({
resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
}));
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const matrixSecrets = await import("../../extensions/matrix/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "matrix"

View File

@@ -1,4 +1,5 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import * as matrixSecrets from "../../extensions/matrix/src/secret-contract.ts";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
@@ -14,8 +15,7 @@ vi.mock("../plugins/web-search-providers.runtime.js", () => ({
resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
}));
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const matrixSecrets = await import("../../extensions/matrix/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "matrix"

View File

@@ -1,12 +1,11 @@
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import * as nextcloudTalkSecrets from "../../extensions/nextcloud-talk/src/secret-contract.ts";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const nextcloudTalkSecrets =
await import("../../extensions/nextcloud-talk/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "nextcloud-talk"

View File

@@ -1,11 +1,11 @@
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import * as telegramSecrets from "../../extensions/telegram/src/secret-contract.ts";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const telegramSecrets = await import("../../extensions/telegram/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "telegram"

View File

@@ -1,11 +1,11 @@
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import * as zaloSecrets from "../../extensions/zalo/src/secret-contract.ts";
import type { AuthProfileStore } from "../agents/auth-profiles.js";
import type { OpenClawConfig } from "../config/config.js";
import { createEmptyPluginRegistry } from "../plugins/registry.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
vi.mock("../channels/plugins/bootstrap-registry.js", async () => {
const zaloSecrets = await import("../../extensions/zalo/src/secret-contract.ts");
vi.mock("../channels/plugins/bootstrap-registry.js", () => {
return {
getBootstrapChannelPlugin: (id: string) =>
id === "zalo"