diff --git a/packages/ai/src/chatTransport.test.ts b/packages/ai/src/chatTransport.test.ts index 08c001510..6bea5eea2 100644 --- a/packages/ai/src/chatTransport.test.ts +++ b/packages/ai/src/chatTransport.test.ts @@ -774,6 +774,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not include query parameters or hash fragments"); }); + it("prioritizes hash validation over credential validation", function () { + expect(function () { + new TriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "https://user:pass@example.com/base#fragment", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not include query parameters or hash fragments"); + }); + it("throws when trimmed baseURL includes username or password credentials", function () { expect(function () { new TriggerChatTransport({ @@ -3145,6 +3156,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not include query parameters or hash fragments"); }); + it("prioritizes hash validation over credential validation in factory", function () { + expect(function () { + createTriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "https://user:pass@example.com/base#fragment", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not include query parameters or hash fragments"); + }); + it("throws from factory when trimmed baseURL includes username or password credentials", function () { expect(function () { createTriggerChatTransport({