diff options
Diffstat (limited to 'test/js/web/url/url.test.ts')
-rw-r--r-- | test/js/web/url/url.test.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/js/web/url/url.test.ts b/test/js/web/url/url.test.ts index 1591c2b44..7ddda80ef 100644 --- a/test/js/web/url/url.test.ts +++ b/test/js/web/url/url.test.ts @@ -1,6 +1,19 @@ import { describe, it, expect } from "bun:test"; describe("url", () => { + it("URL throws", () => { + expect(() => new URL("")).toThrow('"" cannot be parsed as a URL'); + expect(() => new URL(" ")).toThrow('" " cannot be parsed as a URL'); + expect(() => new URL("boop", "http!/example.com")).toThrow( + '"boop" cannot be parsed as a URL against "http!/example.com"', + ); + + // redact + expect(() => new URL("boop", "https!!username:password@example.com")).toThrow( + '"boop" cannot be parsed as a URL against <redacted>', + ); + }); + it("should have correct origin and protocol", () => { var url = new URL("https://example.com"); expect(url.protocol).toBe("https:"); |