mirror of https://github.com/openclaw/openclaw.git
fix(test): use minimal outbound binding registries
This commit is contained in:
parent
fa5827079f
commit
ab43bbd62b
|
|
@ -2,7 +2,8 @@ import fs from "node:fs/promises";
|
|||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { setDefaultChannelPluginRegistryForTests } from "../../commands/channel-test-helpers.js";
|
||||
import { setActivePluginRegistry } from "../../plugins/runtime.js";
|
||||
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
|
||||
import {
|
||||
__testing,
|
||||
bindGenericCurrentConversation,
|
||||
|
|
@ -11,6 +12,24 @@ import {
|
|||
unbindGenericCurrentConversationBindings,
|
||||
} from "./current-conversation-bindings.js";
|
||||
|
||||
function setMinimalCurrentConversationRegistry(): void {
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
pluginId: "slack",
|
||||
source: "test",
|
||||
plugin: {
|
||||
id: "slack",
|
||||
meta: { aliases: [] },
|
||||
conversationBindings: {
|
||||
supportsCurrentConversationBinding: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
describe("generic current-conversation bindings", () => {
|
||||
let previousStateDir: string | undefined;
|
||||
let testStateDir = "";
|
||||
|
|
@ -19,7 +38,7 @@ describe("generic current-conversation bindings", () => {
|
|||
previousStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
testStateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-current-bindings-"));
|
||||
process.env.OPENCLAW_STATE_DIR = testStateDir;
|
||||
setDefaultChannelPluginRegistryForTests();
|
||||
setMinimalCurrentConversationRegistry();
|
||||
__testing.resetCurrentConversationBindingsForTests({
|
||||
deletePersistedFile: true,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { setDefaultChannelPluginRegistryForTests } from "../../commands/channel-test-helpers.js";
|
||||
import { createEmptyPluginRegistry } from "../../plugins/registry-empty.js";
|
||||
import {
|
||||
pinActivePluginChannelRegistry,
|
||||
releasePinnedPluginChannelRegistry,
|
||||
setActivePluginRegistry,
|
||||
} from "../../plugins/runtime.js";
|
||||
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
|
||||
import {
|
||||
__testing,
|
||||
getSessionBindingService,
|
||||
|
|
@ -22,6 +22,35 @@ type SessionBindingServiceModule = typeof import("./session-binding-service.js")
|
|||
const sessionBindingServiceModuleUrl = new URL("./session-binding-service.ts", import.meta.url)
|
||||
.href;
|
||||
|
||||
function setMinimalCurrentConversationRegistry(): void {
|
||||
setActivePluginRegistry(
|
||||
createTestRegistry([
|
||||
{
|
||||
pluginId: "slack",
|
||||
source: "test",
|
||||
plugin: {
|
||||
id: "slack",
|
||||
meta: { aliases: [] },
|
||||
conversationBindings: {
|
||||
supportsCurrentConversationBinding: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
pluginId: "msteams",
|
||||
source: "test",
|
||||
plugin: {
|
||||
id: "msteams",
|
||||
meta: { aliases: [] },
|
||||
conversationBindings: {
|
||||
supportsCurrentConversationBinding: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
async function importSessionBindingServiceModule(
|
||||
cacheBust: string,
|
||||
): Promise<SessionBindingServiceModule> {
|
||||
|
|
@ -53,7 +82,7 @@ function createRecord(input: SessionBindingBindInput): SessionBindingRecord {
|
|||
describe("session binding service", () => {
|
||||
beforeEach(() => {
|
||||
__testing.resetSessionBindingAdaptersForTests();
|
||||
setDefaultChannelPluginRegistryForTests();
|
||||
setMinimalCurrentConversationRegistry();
|
||||
});
|
||||
|
||||
it("normalizes conversation refs and infers current placement", async () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue