mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
perf(test): flatten async channel secret mocks
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user