refactor(auto-reply): share discord auth registry test fixture

This commit is contained in:
Peter Steinberger
2026-03-07 17:44:05 +00:00
parent ce9719c654
commit 7eb48d3cf8
3 changed files with 28 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createOutboundTestPlugin, createTestRegistry } from "../test-utils/channel-plugins.js";
@@ -8,23 +8,9 @@ import { listChatCommands } from "./commands-registry.js";
import { parseActivationCommand } from "./group-activation.js";
import { parseSendPolicyCommand } from "./send-policy.js";
import type { MsgContext } from "./templating.js";
import { installDiscordRegistryHooks } from "./test-helpers/command-auth-registry-fixture.js";
const createRegistry = () =>
createTestRegistry([
{
pluginId: "discord",
plugin: createOutboundTestPlugin({ id: "discord", outbound: { deliveryMode: "direct" } }),
source: "test",
},
]);
beforeEach(() => {
setActivePluginRegistry(createRegistry());
});
afterEach(() => {
setActivePluginRegistry(createRegistry());
});
installDiscordRegistryHooks();
describe("resolveCommandAuthorization", () => {
function resolveWhatsAppAuthorization(params: {