|
1 | | -import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
| 1 | +import { beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 2 | import { parseFeishuConversationId } from "../../extensions/feishu/src/conversation-id.js"; |
3 | 3 | import { resolveAgentWorkspaceDir } from "../agents/agent-scope.js"; |
4 | 4 | import type { ChannelConfiguredBindingProvider, ChannelPlugin } from "../channels/plugins/types.js"; |
5 | 5 | import type { OpenClawConfig } from "../config/config.js"; |
6 | 6 | import { setActivePluginRegistry } from "../plugins/runtime.js"; |
7 | 7 | import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js"; |
8 | 8 | import { parseTelegramTopicConversation } from "./conversation-id.js"; |
9 | | -import * as persistentBindingsResolveModule from "./persistent-bindings.resolve.js"; |
10 | 9 | import { buildConfiguredAcpSessionKey } from "./persistent-bindings.types.js"; |
11 | 10 | const managerMocks = vi.hoisted(() => ({ |
12 | 11 | resolveSession: vi.fn(), |
@@ -43,6 +42,10 @@ let lifecycleBindingsModule: Pick< |
43 | 42 | typeof import("./persistent-bindings.lifecycle.js"), |
44 | 43 | "ensureConfiguredAcpBindingSession" | "resetAcpSessionInPlace" |
45 | 44 | >; |
| 45 | +let persistentBindingsResolveModule: Pick< |
| 46 | + typeof import("./persistent-bindings.resolve.js"), |
| 47 | + "resolveConfiguredAcpBindingRecord" | "resolveConfiguredAcpBindingSpecBySessionKey" |
| 48 | +>; |
46 | 49 |
|
47 | 50 | type ConfiguredBinding = NonNullable<OpenClawConfig["bindings"]>[number]; |
48 | 51 | type BindingRecordInput = Parameters< |
@@ -308,7 +311,10 @@ function mockReadySession(params: { |
308 | 311 | return sessionKey; |
309 | 312 | } |
310 | 313 |
|
311 | | -beforeEach(() => { |
| 314 | +beforeEach(async () => { |
| 315 | + vi.resetModules(); |
| 316 | + persistentBindingsResolveModule = await import("./persistent-bindings.resolve.js"); |
| 317 | + lifecycleBindingsModule = await import("./persistent-bindings.lifecycle.js"); |
312 | 318 | persistentBindings = { |
313 | 319 | resolveConfiguredAcpBindingRecord: |
314 | 320 | persistentBindingsResolveModule.resolveConfiguredAcpBindingRecord, |
@@ -346,10 +352,6 @@ beforeEach(() => { |
346 | 352 | sessionMetaMocks.readAcpSessionEntry.mockReset().mockReturnValue(undefined); |
347 | 353 | }); |
348 | 354 |
|
349 | | -beforeAll(async () => { |
350 | | - lifecycleBindingsModule = await import("./persistent-bindings.lifecycle.js"); |
351 | | -}); |
352 | | - |
353 | 355 | describe("resolveConfiguredAcpBindingRecord", () => { |
354 | 356 | it("resolves discord channel ACP binding from top-level typed bindings", () => { |
355 | 357 | const cfg = createCfgWithBindings([ |
|
0 commit comments