Skip to content

Commit 2246e6e

Browse files
committed
Fixed core tests
1 parent 442979f commit 2246e6e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/core/test/runStream.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, it } from "vitest";
22
import {
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";
1112
class 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
},

0 commit comments

Comments
 (0)