Skip to content

Commit c69808e

Browse files
Expand baseURL precedence coverage for mixed invalid inputs
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 0cb113b commit c69808e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

packages/ai/src/chatTransport.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,17 @@ describe("TriggerChatTransport", function () {
763763
}).toThrowError("baseURL must use http or https protocol");
764764
});
765765

766+
it("prioritizes protocol validation over query/hash/credential validation", function () {
767+
expect(function () {
768+
new TriggerChatTransport({
769+
task: "chat-task",
770+
accessToken: "pk_trigger",
771+
baseURL: "ftp://user:pass@example.com/base?query=1#fragment",
772+
stream: "chat-stream",
773+
});
774+
}).toThrowError("baseURL must use http or https protocol");
775+
});
776+
766777
it("prioritizes query/hash validation over credential validation", function () {
767778
expect(function () {
768779
new TriggerChatTransport({
@@ -3239,6 +3250,17 @@ describe("TriggerChatTransport", function () {
32393250
}).toThrowError("baseURL must use http or https protocol");
32403251
});
32413252

3253+
it("prioritizes protocol validation over query/hash/credential validation in factory", function () {
3254+
expect(function () {
3255+
createTriggerChatTransport({
3256+
task: "chat-task",
3257+
accessToken: "pk_trigger",
3258+
baseURL: "ftp://user:pass@example.com/base?query=1#fragment",
3259+
stream: "chat-stream",
3260+
});
3261+
}).toThrowError("baseURL must use http or https protocol");
3262+
});
3263+
32423264
it("prioritizes query/hash validation over credential validation in factory", function () {
32433265
expect(function () {
32443266
createTriggerChatTransport({

0 commit comments

Comments
 (0)