




























@@ -229,6 +229,13 @@ describe("active-memory plugin", () => {
229229expect(params.messageChannel).toBe(messageChannel);
230230expect(params.messageProvider).toBe(messageProvider);
231231};
232+const firstHookRegistration = () => {
233+const [call] = api.on.mock.calls as Array<[string, Function, Record<string, unknown>?]>;
234+if (!call) {
235+throw new Error("expected before_prompt_build hook registration");
236+}
237+return call;
238+};
232239233240beforeEach(async () => {
234241vi.clearAllMocks();
@@ -294,9 +301,10 @@ describe("active-memory plugin", () => {
294301});
295302296303it("registers a before_prompt_build hook", () => {
297-expect(api.on.mock.calls[0]?.[0]).toBe("before_prompt_build");
298-expect(typeof api.on.mock.calls[0]?.[1]).toBe("function");
299-expect(api.on.mock.calls[0]?.[2]).toEqual({ timeoutMs: 15_000 });
304+const [hookName, handler, options] = firstHookRegistration();
305+expect(hookName).toBe("before_prompt_build");
306+expect(typeof handler).toBe("function");
307+expect(options).toEqual({ timeoutMs: 15_000 });
300308expect(hookOptions.before_prompt_build?.timeoutMs).toBe(15_000);
301309});
302310此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。