Cover trimmed ws and wss baseURL rejection
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -664,6 +664,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when trimmed baseURL protocol is ws", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: " ws://example.com ",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -675,6 +686,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when trimmed baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: " wss://example.com ",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws when baseURL includes query parameters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -2991,6 +3013,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when trimmed baseURL protocol is ws", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: " ws://example.com ",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
@@ -3002,6 +3035,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when trimmed baseURL protocol is wss", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: " wss://example.com ",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must use http or https protocol");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL includes query parameters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
|
||||
Reference in New Issue
Block a user