@@ -232,11 +232,11 @@ describe.each([
232232 } ) ;
233233 const response = await client . generateResponse ( ) ;
234234 expect ( response ) . toBeDefined ( ) ;
235- expect ( response . id ) . toBeDefined ( ) ;
236- expect ( response . id ! . length ) . toBeGreaterThan ( 0 ) ;
237- for await ( const item of response ) {
235+ expect ( response ! . id ) . toBeDefined ( ) ;
236+ expect ( response ! . id ! . length ) . toBeGreaterThan ( 0 ) ;
237+ for await ( const item of response ! ) {
238238 expect ( item ) . toBeDefined ( ) ;
239- expect ( item . responseId ) . toBe ( response . id ) ;
239+ expect ( item . responseId ) . toBe ( response ! . id ) ;
240240 expect ( item . previousItemId ) . toBe ( sentItem . id ) ;
241241 }
242242 } ) ;
@@ -254,14 +254,15 @@ describe.each([
254254 ] ,
255255 } ) ;
256256 const response = await client . generateResponse ( ) ;
257- await response . cancel ( ) ;
257+ expect ( response ) . toBeDefined ( ) ;
258+ await response ! . cancel ( ) ;
258259
259260 let itemCount = 0 ;
260- for await ( const _item of response ) {
261+ for await ( const _item of response ! ) {
261262 itemCount ++ ;
262263 }
263264 expect ( itemCount ) . toBe ( 0 ) ;
264- expect ( [ "cancelled" , "completed" ] . includes ( response . status ) ) ;
265+ expect ( [ "cancelled" , "completed" ] . includes ( response ! . status ) ) ;
265266 } ) ;
266267
267268 it ( "items should properly be emitted for text in text out" , async ( ) => {
@@ -277,8 +278,9 @@ describe.each([
277278 ] ,
278279 } ) ;
279280 const response = await client . generateResponse ( ) ;
281+ expect ( response ) . toBeDefined ( ) ;
280282
281- for await ( const item of response ) {
283+ for await ( const item of response ! ) {
282284 expect ( item . type ) . toBe ( "message" ) ;
283285 assert ( item . type === "message" ) ;
284286 for await ( const part of item ) {
@@ -309,8 +311,9 @@ describe.each([
309311 ] ,
310312 } ) ;
311313 const response = await client . generateResponse ( ) ;
314+ expect ( response ) . toBeDefined ( ) ;
312315
313- for await ( const item of response ) {
316+ for await ( const item of response ! ) {
314317 expect ( item . type ) . toBe ( "message" ) ;
315318 assert ( item . type === "message" ) ;
316319 for await ( const part of item ) {
@@ -366,8 +369,9 @@ describe.each([
366369 ] ,
367370 } ) ;
368371 const response = await client . generateResponse ( ) ;
372+ expect ( response ) . toBeDefined ( ) ;
369373
370- for await ( const item of response ) {
374+ for await ( const item of response ! ) {
371375 expect ( item . type ) . toBe ( "function_call" ) ;
372376 assert ( item . type === "function_call" ) ;
373377 expect ( item . functionName ) . toBe ( "get_weather_by_location" ) ;
@@ -398,8 +402,9 @@ describe.each([
398402 ] ,
399403 } ) ;
400404 const response = await client . generateResponse ( ) ;
405+ expect ( response ) . toBeDefined ( ) ;
401406
402- for await ( const item of response ) {
407+ for await ( const item of response ! ) {
403408 expect ( item . type ) . toBe ( "function_call" ) ;
404409 assert ( item . type === "function_call" ) ;
405410 expect ( item . functionName ) . toBe ( "get_weather_by_location" ) ;
@@ -430,8 +435,9 @@ describe.each([
430435 ] ,
431436 } ) ;
432437 const response = await client . generateResponse ( ) ;
438+ expect ( response ) . toBeDefined ( ) ;
433439
434- for await ( const item of response ) {
440+ for await ( const item of response ! ) {
435441 expect ( item . type ) . toBe ( "function_call" ) ;
436442 assert ( item . type === "function_call" ) ;
437443 expect ( item . functionName ) . toBe ( "get_weather_by_location" ) ;
@@ -462,8 +468,9 @@ describe.each([
462468 ] ,
463469 } ) ;
464470 const response = await client . generateResponse ( ) ;
471+ expect ( response ) . toBeDefined ( ) ;
465472
466- for await ( const item of response ) {
473+ for await ( const item of response ! ) {
467474 expect ( item . type ) . toBe ( "function_call" ) ;
468475 assert ( item . type === "function_call" ) ;
469476 expect ( item . functionName ) . toBe ( "get_weather_by_location" ) ;
0 commit comments