@@ -55,7 +55,7 @@ describe('daemon client', () => {
5555 describe ( 'parsing' , ( ) => {
5656 it ( 'handles MCP response with text format' , async ( ) => {
5757 const textResponse = { content : [ { type : 'text' as const , text : 'test' } ] } ;
58- assert . strictEqual ( handleResponse ( textResponse , 'md' ) , 'test' ) ;
58+ assert . strictEqual ( await handleResponse ( textResponse , 'md' ) , 'test' ) ;
5959 } ) ;
6060
6161 it ( 'handles JSON response' , async ( ) => {
@@ -67,7 +67,7 @@ describe('daemon client', () => {
6767 } ,
6868 } ;
6969 assert . strictEqual (
70- handleResponse ( jsonResponse , 'json' ) ,
70+ await handleResponse ( jsonResponse , 'json' ) ,
7171 JSON . stringify ( jsonResponse . structuredContent ) ,
7272 ) ;
7373 } ) ;
@@ -78,7 +78,7 @@ describe('daemon client', () => {
7878 content : [ { type : 'text' as const , text : 'Something went wrong' } ] ,
7979 } ;
8080 assert . strictEqual (
81- handleResponse ( errorResponse , 'md' ) ,
81+ await handleResponse ( errorResponse , 'md' ) ,
8282 JSON . stringify ( errorResponse . content ) ,
8383 ) ;
8484 } ) ;
@@ -88,29 +88,24 @@ describe('daemon client', () => {
8888 content : [ { type : 'text' as const , text : 'Fall through text' } ] ,
8989 } ;
9090 assert . deepStrictEqual (
91- handleResponse ( textResponse , 'json' ) ,
91+ await handleResponse ( textResponse , 'json' ) ,
9292 JSON . stringify ( [ 'Fall through text' ] ) ,
9393 ) ;
9494 } ) ;
9595
96- it ( 'throws error for unsupported content type ' , async ( ) => {
96+ it ( 'supports images ' , async ( ) => {
9797 const unsupportedContentResponse = {
9898 content : [
9999 {
100- type : 'resource' as const ,
101- resource : {
102- uri : 'data:image/png;base64,base64data' ,
103- blob : 'base64data' ,
104- mimeType : 'image/png' ,
105- } ,
100+ type : 'image' as const ,
101+ data : 'base64data' ,
102+ mimeType : 'image/png' ,
106103 } ,
107104 ] ,
108105 structuredContent : { } ,
109106 } ;
110- assert . throws (
111- ( ) => handleResponse ( unsupportedContentResponse , 'md' ) ,
112- new Error ( 'Not supported response content type' ) ,
113- ) ;
107+ const response = await handleResponse ( unsupportedContentResponse , 'md' ) ;
108+ assert . ok ( response . includes ( '.png' ) ) ;
114109 } ) ;
115110 } ) ;
116111} ) ;
0 commit comments