diff --git a/apps/server/src/core/ai-chat/tools/ai-chat-tools.service.spec.ts b/apps/server/src/core/ai-chat/tools/ai-chat-tools.service.spec.ts index ea820041..33960a3f 100644 --- a/apps/server/src/core/ai-chat/tools/ai-chat-tools.service.spec.ts +++ b/apps/server/src/core/ai-chat/tools/ai-chat-tools.service.spec.ts @@ -63,9 +63,12 @@ describe('AiChatToolsService deletePage guardrail (H4)', () => { {} as never, {} as never, {} as never, - // sandboxStore (only used by the stash tool closure, which these tests do - // not execute). - {} as never, + // sandboxStore: forUser() eagerly calls asSink() to wire the stash tool, + // even though these tests never execute it — return a no-op sink so the + // tool wiring in forUser() succeeds. + { + asSink: () => ({ put: jest.fn(), has: jest.fn(), evict: jest.fn() }), + } as never, ); }); @@ -178,9 +181,12 @@ describe('AiChatToolsService expanded toolset guardrails', () => { {} as never, {} as never, {} as never, - // sandboxStore (only used by the stash tool closure, which these tests do - // not execute). - {} as never, + // sandboxStore: forUser() eagerly calls asSink() to wire the stash tool, + // even though these tests never execute it — return a no-op sink so the + // tool wiring in forUser() succeeds. + { + asSink: () => ({ put: jest.fn(), has: jest.fn(), evict: jest.fn() }), + } as never, ); }); @@ -296,9 +302,12 @@ describe('AiChatToolsService node-arg JSON-string coercion', () => { {} as never, {} as never, {} as never, - // sandboxStore (only used by the stash tool closure, which these tests do - // not execute). - {} as never, + // sandboxStore: forUser() eagerly calls asSink() to wire the stash tool, + // even though these tests never execute it — return a no-op sink so the + // tool wiring in forUser() succeeds. + { + asSink: () => ({ put: jest.fn(), has: jest.fn(), evict: jest.fn() }), + } as never, ); }); @@ -449,9 +458,12 @@ describe('AiChatToolsService model-friendly input validation (#190)', () => { {} as never, {} as never, {} as never, - // sandboxStore (only used by the stash tool closure, which these tests do - // not execute). - {} as never, + // sandboxStore: forUser() eagerly calls asSink() to wire the stash tool, + // even though these tests never execute it — return a no-op sink so the + // tool wiring in forUser() succeeds. + { + asSink: () => ({ put: jest.fn(), has: jest.fn(), evict: jest.fn() }), + } as never, ); });