Cover hair-space baseURL wrapper and internal validation
Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
@@ -672,6 +672,7 @@ Examples:
|
||||
- ✅ `\u00A0https://api.trigger.dev/custom-prefix/\u00A0` (non-breaking-space wrapper trimmed)
|
||||
- ✅ `\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed)
|
||||
- ✅ `\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
|
||||
- ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-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)
|
||||
@@ -705,6 +706,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u200Dinternal`
|
||||
- ❌ `https://api.trigger.dev/\u1680internal`
|
||||
- ❌ `https://api.trigger.dev/\u2007internal`
|
||||
- ❌ `https://api.trigger.dev/\u200Ainternal`
|
||||
- ❌ `https://api.trigger.dev/\u202Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u205Finternal`
|
||||
- ❌ `https://api.trigger.dev/\u180Einternal`
|
||||
|
||||
@@ -179,6 +179,7 @@ Examples:
|
||||
- ✅ `\u00A0https://api.trigger.dev/custom-prefix/\u00A0` (non-breaking-space wrapper trimmed)
|
||||
- ✅ `\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed)
|
||||
- ✅ `\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed)
|
||||
- ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-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)
|
||||
@@ -212,6 +213,7 @@ Examples:
|
||||
- ❌ `https://api.trigger.dev/\u200Dinternal` (internal zero-width-joiner characters)
|
||||
- ❌ `https://api.trigger.dev/\u1680internal` (internal ogham-space-mark characters)
|
||||
- ❌ `https://api.trigger.dev/\u2007internal` (internal figure-space characters)
|
||||
- ❌ `https://api.trigger.dev/\u200Ainternal` (internal hair-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)
|
||||
|
||||
@@ -961,6 +961,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws when baseURL contains internal hair-space characters", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u200Ainternal",
|
||||
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({
|
||||
@@ -1478,6 +1489,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts hair-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u200Ahttps://api.trigger.dev/custom-prefix/\u200A",
|
||||
stream: "chat-stream",
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts ideographic-space wrapped baseURL values", function () {
|
||||
expect(function () {
|
||||
new TriggerChatTransport({
|
||||
@@ -4098,6 +4120,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).toThrowError("baseURL must not contain internal whitespace characters");
|
||||
});
|
||||
|
||||
it("throws from factory when baseURL contains internal hair-space characters", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "https://api.trigger.dev/\u200Ainternal",
|
||||
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({
|
||||
@@ -4604,6 +4637,17 @@ describe("TriggerChatTransport", function () {
|
||||
}).not.toThrow();
|
||||
});
|
||||
|
||||
it("accepts hair-space wrapped baseURL values from factory", function () {
|
||||
expect(function () {
|
||||
createTriggerChatTransport({
|
||||
task: "chat-task",
|
||||
accessToken: "pk_trigger",
|
||||
baseURL: "\u200Ahttps://api.trigger.dev/custom-prefix/\u200A",
|
||||
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