From d09b7026f9a4093398643e720aba7e003b850d54 Mon Sep 17 00:00:00 2001 From: shamAnimates <145093437+shamAnimates@users.noreply.github.com> Date: Sun, 16 Aug 2026 08:14:26 +0530 Subject: [PATCH] test(tools): type scoped operation results --- packages/tools/src/tool-operations.test.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/tools/src/tool-operations.test.ts b/packages/tools/src/tool-operations.test.ts index 0c06648b..06754a60 100644 --- a/packages/tools/src/tool-operations.test.ts +++ b/packages/tools/src/tool-operations.test.ts @@ -30,9 +30,15 @@ import * as openAi from "./openai/tools" const API_KEY = "sm_test_key" -type ToolWithExecute = { execute: (args: Record) => unknown } +type ToolExecutionResult = { success: boolean; error?: string } +type ToolWithExecute = { + execute: (args: Record) => Promise +} -function executeTool(tool: unknown, args: Record) { +function executeTool( + tool: unknown, + args: Record, +): Promise { return (tool as ToolWithExecute).execute(args) } @@ -57,7 +63,7 @@ describe("configured container scope", () => { const fetchMock = vi.fn() vi.stubGlobal("fetch", fetchMock) - const results = (await Promise.all([ + const results: ToolExecutionResult[] = await Promise.all([ executeTool(aiSdk.getProfileTool(API_KEY, config), { containerTag: "tenant-b", }), @@ -87,7 +93,7 @@ describe("configured container scope", () => { containerTag: "tenant-b", memoryId: "mem_1", }), - ])) as Array<{ success: boolean; error?: string }> + ]) expect(results).toHaveLength(6) for (const result of results) {