@@ -100,16 +100,21 @@ describe("acp content conversion", () => {
100100 } )
101101
102102 test ( "resource with text becomes a sourced text part" , ( ) => {
103- expect (
104- contentBlockToParts ( {
105- type : "resource" ,
106- resource : {
107- uri : "file:///tmp/context.txt#L12-L14" ,
108- mimeType : "text/plain" ,
109- text : "context" ,
110- } ,
111- } ) ,
112- ) . toEqual ( [ { type : "text" , text : "[/tmp/context.txt:12]\ncontext" } ] )
103+ const result = contentBlockToParts ( {
104+ type : "resource" ,
105+ resource : {
106+ uri : "file:///tmp/context.txt#L12-L14" ,
107+ mimeType : "text/plain" ,
108+ text : "context" ,
109+ } ,
110+ } )
111+ expect ( result ) . toHaveLength ( 1 )
112+ expect ( result [ 0 ] ?. type ) . toBe ( "text" )
113+ if ( result [ 0 ] ?. type === "text" ) {
114+ expect ( result [ 0 ] . text . endsWith ( "\ncontext" ) ) . toBe ( true )
115+ expect ( result [ 0 ] . text . includes ( "context.txt" ) ) . toBe ( true )
116+ expect ( result [ 0 ] . text . includes ( "12" ) ) . toBe ( true )
117+ }
113118 } )
114119
115120 test ( "resource with text uses URI fallback for non-file resources" , ( ) => {
@@ -124,6 +129,23 @@ describe("acp content conversion", () => {
124129 ) . toEqual ( [ { type : "text" , text : "[mcp://server/context]\ncontext" } ] )
125130 } )
126131
132+ test ( "resource with text includes file path" , ( ) => {
133+ const result = contentBlockToParts ( {
134+ type : "resource" ,
135+ resource : {
136+ uri : "file:///tmp/context.txt" ,
137+ mimeType : "text/plain" ,
138+ text : "context" ,
139+ } ,
140+ } )
141+ expect ( result ) . toHaveLength ( 1 )
142+ expect ( result [ 0 ] ?. type ) . toBe ( "text" )
143+ if ( result [ 0 ] ?. type === "text" ) {
144+ expect ( result [ 0 ] . text . endsWith ( "\ncontext" ) ) . toBe ( true )
145+ expect ( result [ 0 ] . text . includes ( "context.txt" ) ) . toBe ( true )
146+ }
147+ } )
148+
127149 test ( "resource with blob and mimeType becomes a data URL file part" , ( ) => {
128150 expect (
129151 contentBlockToParts ( {
0 commit comments