File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,21 @@ describe('toolAgent', () => {
7575 } ) ;
7676
7777 it ( 'should handle unknown tools' , async ( ) => {
78- await expect (
79- executeToolCall (
80- {
81- id : '1' ,
82- name : 'nonexistentTool' ,
83- content : JSON . stringify ( { } ) ,
84- } ,
85- [ mockTool ] ,
86- toolContext ,
87- ) ,
88- ) . rejects . toThrow ( "No tool with the name 'nonexistentTool' exists." ) ;
78+ const result = await executeToolCall (
79+ {
80+ id : '1' ,
81+ name : 'nonexistentTool' ,
82+ content : JSON . stringify ( { } ) ,
83+ } ,
84+ [ mockTool ] ,
85+ toolContext ,
86+ ) ;
87+
88+ // Parse the result as JSON
89+ const parsedResult = JSON . parse ( result ) ;
90+
91+ // Check that it contains the expected error properties
92+ expect ( parsedResult . error ) . toBe ( true ) ;
8993 } ) ;
9094
9195 it ( 'should handle tool execution errors' , async ( ) => {
You can’t perform that action at this time.
0 commit comments