Skip to content

Commit 9cf96d9

Browse files
Cover inactive reconnect string cleanup failures without onError
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent eaf59f2 commit 9cf96d9

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
@@ -635,6 +635,31 @@ describe("TriggerChatTransport", function () {
635635
expect(stream).toBeNull();
636636
});
637637

638+
it("returns null when inactive reconnect string cleanup delete fails without onError callback", async function () {
639+
const runStore = new FailingCleanupDeleteValueRunStore("cleanup delete string failure");
640+
runStore.set({
641+
chatId: "chat-inactive-delete-string-no-onerror",
642+
runId: "run_inactive_delete_string_no_onerror",
643+
publicAccessToken: "pk_inactive_delete_string_no_onerror",
644+
streamKey: "chat-stream",
645+
lastEventId: "10-0",
646+
isActive: false,
647+
});
648+
649+
const transport = new TriggerChatTransport({
650+
task: "chat-task",
651+
stream: "chat-stream",
652+
accessToken: "pk_trigger",
653+
runStore,
654+
});
655+
656+
const stream = await transport.reconnectToStream({
657+
chatId: "chat-inactive-delete-string-no-onerror",
658+
});
659+
660+
expect(stream).toBeNull();
661+
});
662+
638663
it("normalizes non-Error inactive reconnect cleanup delete failures through onError", async function () {
639664
const errors: TriggerChatTransportError[] = [];
640665
const runStore = new FailingCleanupDeleteValueRunStore("cleanup delete string failure");

0 commit comments

Comments
 (0)