Cover six-per-em-space baseURL wrapper and internal validation
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -675,6 +675,7 @@ Examples:
|
||||
- ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
|
||||
- ✅ `\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)
|
||||
- ✅ `\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)
|
||||
@@ -711,6 +712,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u200Ainternal`
|
||||
- ❌ `https://api.trigger.dev/\u2009internal`
|
||||
- ❌ `https://api.trigger.dev/\u2008internal`
|
||||
- ❌ `https://api.trigger.dev/\u2006internal`
|
||||
- ❌ `https://api.trigger.dev/\u202Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u205Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u180Einternal`
|
||||
|
||||
@@ -182,6 +182,7 @@ Examples:
|
||||
- ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed)
|
||||
- ✅ `\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)
|
||||
- ✅ `\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)
|
||||
@@ -218,6 +219,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u200Ainternal` (internal hair-space characters)
|
||||
- ❌ `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/\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)
|
||||
|
||||
@@ -994,6 +994,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws when baseURL contains internal six-per-em-space characters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u2006internal",
|
||||
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({
|
||||
@@ -1544,6 +1555,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts six-per-em-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u2006https://api.trigger.dev/custom-prefix/\u2006",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts ideographic-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -4197,6 +4219,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL contains internal six-per-em-space characters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u2006internal",
|
||||
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({
|
||||
@@ -4736,6 +4769,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts six-per-em-space wrapped baseURL values from factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u2006https://api.trigger.dev/custom-prefix/\u2006",
|
||||
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