mirror of https://github.com/openclaw/openclaw.git
test(channels): use narrow active registries in sticky tests
This commit is contained in:
parent
9aab672a69
commit
9b83e462cf
|
|
@ -3,7 +3,8 @@ import type { NativeCommandSpec } from "openclaw/plugin-sdk/command-auth";
|
|||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { clearPluginCommands, registerPluginCommand } from "openclaw/plugin-sdk/plugin-runtime";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { setDefaultChannelPluginRegistryForTests } from "../../../../src/commands/channel-test-helpers.js";
|
||||
import { setActivePluginRegistry } from "../../../../src/plugins/runtime.js";
|
||||
import { createTestRegistry } from "../../../../src/test-utils/channel-plugins.js";
|
||||
import {
|
||||
createMockCommandInteraction,
|
||||
type MockCommandInteraction,
|
||||
|
|
@ -338,7 +339,7 @@ describe("Discord native plugin command dispatch", () => {
|
|||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
clearPluginCommands();
|
||||
setDefaultChannelPluginRegistryForTests();
|
||||
setActivePluginRegistry(createTestRegistry());
|
||||
const actualPluginRuntime = await vi.importActual<
|
||||
typeof import("openclaw/plugin-sdk/plugin-runtime")
|
||||
>("openclaw/plugin-sdk/plugin-runtime");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
|||
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
|
||||
import { __testing as sessionBindingTesting } from "openclaw/plugin-sdk/conversation-runtime";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { setDefaultChannelPluginRegistryForTests } from "../../../src/commands/channel-test-helpers.js";
|
||||
import { setActivePluginRegistry } from "../../../src/plugins/runtime.js";
|
||||
import { createTestRegistry } from "../../../src/test-utils/channel-plugins.js";
|
||||
import { buildLineMessageContext, buildLinePostbackContext } from "./bot-message-context.js";
|
||||
import { linePlugin } from "./channel.js";
|
||||
import type { ResolvedLineAccount } from "./types.js";
|
||||
|
|
@ -59,7 +60,15 @@ describe("buildLineMessageContext", () => {
|
|||
}) as PostbackEvent;
|
||||
|
||||
beforeEach(async () => {
|
||||
setDefaultChannelPluginRegistryForTests();
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
pluginId: linePlugin.id,
|
||||
plugin: linePlugin,
|
||||
source: "test",
|
||||
},
|
||||
]),
|
||||
);
|
||||
sessionBindingTesting.resetSessionBindingAdaptersForTests();
|
||||
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-line-context-"));
|
||||
storePath = path.join(tmpDir, "sessions.json");
|
||||
|
|
|
|||
Loading…
Reference in New Issue