File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11import { describe , expect , it } from "vitest" ;
22import {
33 RunSubscription ,
4+ SSEStreamPart ,
45 StreamSubscription ,
56 StreamSubscriptionFactory ,
67} from "../src/v3/apiClient/runStream.js" ;
@@ -11,11 +12,15 @@ import type { SubscribeRunRawShape } from "../src/v3/schemas/api.js";
1112class TestStreamSubscription implements StreamSubscription {
1213 constructor ( private chunks : unknown [ ] ) { }
1314
14- async subscribe ( ) : Promise < ReadableStream < unknown > > {
15+ async subscribe ( ) : Promise < ReadableStream < SSEStreamPart < unknown > > > {
1516 return new ReadableStream ( {
1617 start : async ( controller ) => {
17- for ( const chunk of this . chunks ) {
18- controller . enqueue ( chunk ) ;
18+ for ( let i = 0 ; i < this . chunks . length ; i ++ ) {
19+ controller . enqueue ( {
20+ id : `msg-${ i } ` ,
21+ chunk : this . chunks [ i ] ,
22+ timestamp : Date . now ( ) + i ,
23+ } ) ;
1924 }
2025 controller . close ( ) ;
2126 } ,
You can’t perform that action at this time.
0 commit comments