Skip to content

Commit 0856980

Browse files
committed
fixed chat tests
1 parent 8df3de2 commit 0856980

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/trigger-sdk/src/v3/chat.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,7 @@ describe("TriggerChatTransport", () => {
17971797
expect(lastCall![1].lastEventId).toBeDefined();
17981798
});
17991799

1800-
it("should fire with null when session is deleted (stream ends naturally)", async () => {
1800+
it("should preserve session when stream ends naturally (run stays alive between turns)", async () => {
18011801
const onSessionChange = vi.fn();
18021802

18031803
global.fetch = vi.fn().mockImplementation(async (url: string | URL) => {
@@ -1846,11 +1846,12 @@ describe("TriggerChatTransport", () => {
18461846
const reader = stream.getReader();
18471847
while (!(await reader.read()).done) {}
18481848

1849-
// Session should have been created then deleted
1849+
// Session should have been created but NOT deleted — the run stays
1850+
// alive between turns and the session is needed for reconnection.
18501851
expect(onSessionChange).toHaveBeenCalledWith("chat-end", expect.objectContaining({
18511852
runId: "run_end",
18521853
}));
1853-
expect(onSessionChange).toHaveBeenCalledWith("chat-end", null);
1854+
expect(onSessionChange).not.toHaveBeenCalledWith("chat-end", null);
18541855
});
18551856

18561857
it("should be updatable via setOnSessionChange", async () => {

0 commit comments

Comments
 (0)