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', () => {
75
75
} ) ;
76
76
77
77
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 ) ;
89
93
} ) ;
90
94
91
95
it ( 'should handle tool execution errors' , async ( ) => {
You can’t perform that action at this time.
0 commit comments