From 666b991926bccf958e90ac0a2cebc28dbd67cda1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 15 Feb 2026 05:44:54 +0000 Subject: [PATCH] Cover trimmed wrapper query/hash validation path Co-authored-by: Eric Allam --- packages/ai/src/chatTransport.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/ai/src/chatTransport.test.ts b/packages/ai/src/chatTransport.test.ts index 04491cff5..13ec2f76c 100644 --- a/packages/ai/src/chatTransport.test.ts +++ b/packages/ai/src/chatTransport.test.ts @@ -841,6 +841,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not include query parameters or hash fragments"); }); + it("throws query/hash validation after trimming wrapper whitespace", function () { + expect(function () { + new TriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: " https://api.trigger.dev/base?query=1 ", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not include query parameters or hash fragments"); + }); + it("throws when baseURL includes hash fragments", function () { expect(function () { new TriggerChatTransport({ @@ -3426,6 +3437,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not include query parameters or hash fragments"); }); + it("throws query/hash validation after trimming wrapper whitespace in factory", function () { + expect(function () { + createTriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: " https://api.trigger.dev/base?query=1 ", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not include query parameters or hash fragments"); + }); + it("throws from factory when baseURL includes hash fragments", function () { expect(function () { createTriggerChatTransport({