@@ -128,17 +128,20 @@ describe("gateway session store", () => {
128128 activeSessionBindings : new Map ( ) ,
129129 } ) ;
130130
131- const raw = JSON . parse ( await readFile ( storePath , "utf8" ) ) as {
132- runs ?: Array < Record < string , unknown > > ;
133- } ;
134- const run = raw . runs ?. [ 0 ] ;
135- expect ( run ) . toBeDefined ( ) ;
136- expect ( ( run ?. response as string ) . length ) . toBeLessThan ( 17_000 ) ;
137- expect ( run ?. images ) . toEqual ( [
138- {
139- type : "image" ,
140- mimeType : "image/png" ,
141- data : "[image payload omitted]" ,
131+ const raw = JSON . parse ( await readFile ( storePath , "utf8" ) ) as {
132+ runs ?: Array < Record < string , unknown > > ;
133+ } ;
134+ const run = raw . runs ?. [ 0 ] ;
135+ expect ( run ) . toBeDefined ( ) ;
136+ if ( ! run ) {
137+ throw new Error ( "Expected a persisted run" ) ;
138+ }
139+ expect ( ( run . response as string ) . length ) . toBeLessThan ( 17_000 ) ;
140+ expect ( run . images ) . toEqual ( [
141+ {
142+ type : "image" ,
143+ mimeType : "image/png" ,
144+ data : "[image payload omitted]" ,
142145 } ,
143146 ] ) ;
144147 expect ( run ?. meta ) . toMatchObject ( {
@@ -152,9 +155,9 @@ describe("gateway session store", () => {
152155 ] ,
153156 nested : {
154157 imageData : "[image payload omitted]" ,
158+ } ,
155159 } ,
156- } ,
160+ } ) ;
161+ expect ( ( ( run . meta as any ) . latestToolResult . nested . text as string ) . length ) . toBeLessThan ( 17_000 ) ;
157162 } ) ;
158- expect ( ( ( run ?. meta as any ) . latestToolResult . nested . text as string ) . length ) . toBeLessThan ( 17_000 ) ;
159163 } ) ;
160- } ) ;
0 commit comments