Skip to content

Commit bec4401

Browse files
Assert full run-state transition snapshots on stream completion
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 2b6723e commit bec4401

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/ai/src/chatTransport.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2989,6 +2989,31 @@ describe("TriggerChatTransport", function () {
29892989
return trackedRunStore.deleteCalls.includes("chat-cleanup");
29902990
});
29912991

2992+
expect(trackedRunStore.setSnapshots).toHaveLength(4);
2993+
expect(trackedRunStore.setSnapshots[0]).toMatchObject({
2994+
chatId: "chat-cleanup",
2995+
runId: "run_cleanup",
2996+
isActive: true,
2997+
lastEventId: undefined,
2998+
});
2999+
expect(trackedRunStore.setSnapshots[1]).toMatchObject({
3000+
chatId: "chat-cleanup",
3001+
runId: "run_cleanup",
3002+
isActive: true,
3003+
lastEventId: "1-0",
3004+
});
3005+
expect(trackedRunStore.setSnapshots[2]).toMatchObject({
3006+
chatId: "chat-cleanup",
3007+
runId: "run_cleanup",
3008+
isActive: true,
3009+
lastEventId: "2-0",
3010+
});
3011+
expect(trackedRunStore.setSnapshots[3]).toMatchObject({
3012+
chatId: "chat-cleanup",
3013+
runId: "run_cleanup",
3014+
isActive: false,
3015+
lastEventId: "2-0",
3016+
});
29923017
expect(trackedRunStore.get("chat-cleanup")).toBeUndefined();
29933018
});
29943019

0 commit comments

Comments
 (0)