@@ -41,7 +41,7 @@ describe('TOOL_USE_RENDERERS', () => {
4141 expect ( html ) . toContain ( '<script>' ) ;
4242 } ) ;
4343
44- it ( 'renderReadUse escapes file path in body' , ( ) => {
44+ it ( 'renderReadUse escapes file path in body and summary ' , ( ) => {
4545 const html = renderToolUse ( {
4646 name : 'Read' ,
4747 input : { file_path : 'C:\\tmp\\<evil>.txt' } ,
@@ -81,8 +81,8 @@ describe('getToolSummary', () => {
8181 expect ( getToolSummary ( 'Bash' , { command : 'ls -la' } ) ) . toContain ( 'ls -la' ) ;
8282 } ) ;
8383
84- it ( 'formats Read summary with escaped path ' , ( ) => {
85- expect ( getToolSummary ( 'Read' , { file_path : 'a<b' } ) ) . toContain ( '< b') ;
84+ it ( 'formats Read summary as plain text (escaping deferred to wrapToolUse) ' , ( ) => {
85+ expect ( getToolSummary ( 'Read' , { file_path : 'a<b' } ) ) . toBe ( 'Read: a< b') ;
8686 } ) ;
8787} ) ;
8888
@@ -147,4 +147,11 @@ describe('renderToolResult fallback', () => {
147147 expect ( html ) . toContain ( 'Tool result (custom_type)' ) ;
148148 expect ( html ) . toContain ( 'tool-result' ) ;
149149 } ) ;
150+
151+ it ( 'uses fallback when result_type is an inherited property (e.g. constructor)' , ( ) => {
152+ const html = renderToolResult ( { result_type : 'constructor' } ) ;
153+ expect ( html ) . toContain ( 'Tool result (constructor)' ) ;
154+ expect ( html ) . toContain ( 'tool-result' ) ;
155+ expect ( Object . prototype . hasOwnProperty . call ( TOOL_RESULT_RENDERERS , 'constructor' ) ) . toBe ( false ) ;
156+ } ) ;
150157} ) ;
0 commit comments