Cover em-space baseURL wrapper and internal validation
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -676,6 +676,7 @@ Examples:
|
||||
- ✅ `\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
|
||||
- ✅ `\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
|
||||
- ✅ `\u2006https://api.trigger.dev/custom-prefix/\u2006` (six-per-em-space wrapper trimmed)
|
||||
- ✅ `\u2003https://api.trigger.dev/custom-prefix/\u2003` (em-space wrapper trimmed)
|
||||
- ✅ `\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
|
||||
- ✅ `\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
|
||||
- ✅ `\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
|
||||
@@ -713,6 +714,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u2009internal`
|
||||
- ❌ `https://api.trigger.dev/\u2008internal`
|
||||
- ❌ `https://api.trigger.dev/\u2006internal`
|
||||
- ❌ `https://api.trigger.dev/\u2003internal`
|
||||
- ❌ `https://api.trigger.dev/\u202Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u205Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u180Einternal`
|
||||
|
||||
@@ -183,6 +183,7 @@ Examples:
|
||||
- ✅ `\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed)
|
||||
- ✅ `\u2008https://api.trigger.dev/custom-prefix/\u2008` (punctuation-space wrapper trimmed)
|
||||
- ✅ `\u2006https://api.trigger.dev/custom-prefix/\u2006` (six-per-em-space wrapper trimmed)
|
||||
- ✅ `\u2003https://api.trigger.dev/custom-prefix/\u2003` (em-space wrapper trimmed)
|
||||
- ✅ `\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed)
|
||||
- ✅ `\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed)
|
||||
- ✅ `\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed)
|
||||
@@ -220,6 +221,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u2009internal` (internal thin-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u2008internal` (internal punctuation-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u2006internal` (internal six-per-em-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u2003internal` (internal em-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u202Finternal` (internal narrow no-break space characters)
|
||||
- ❌ `https://api.trigger.dev/\u205Finternal` (internal medium-mathematical-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u180Einternal` (internal mongolian-vowel-separator characters)
|
||||
|
||||
@@ -1005,6 +1005,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws when baseURL contains internal em-space characters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u2003internal",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws when baseURL contains internal mongolian-vowel-separator characters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -1566,6 +1577,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts em-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u2003https://api.trigger.dev/custom-prefix/\u2003",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts ideographic-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -4230,6 +4252,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL contains internal em-space characters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u2003internal",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL contains internal mongolian-vowel-separator characters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
@@ -4780,6 +4813,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts em-space wrapped baseURL values from factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u2003https://api.trigger.dev/custom-prefix/\u2003",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts ideographic-space wrapped baseURL values from factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
|
||||
Reference in New Issue
Block a user