diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/testdata/run/077_fetch_empty.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/unit/url_test.ts | 30 |
2 files changed, 19 insertions, 13 deletions
diff --git a/cli/tests/testdata/run/077_fetch_empty.ts.out b/cli/tests/testdata/run/077_fetch_empty.ts.out index e546cfcec..797574350 100644 --- a/cli/tests/testdata/run/077_fetch_empty.ts.out +++ b/cli/tests/testdata/run/077_fetch_empty.ts.out @@ -1,2 +1,2 @@ -[WILDCARD]error: Uncaught TypeError: Invalid URL +[WILDCARD]error: Uncaught TypeError: Invalid URL: '' [WILDCARD] diff --git a/cli/tests/unit/url_test.ts b/cli/tests/unit/url_test.ts index 0ba848add..1faf33cd0 100644 --- a/cli/tests/unit/url_test.ts +++ b/cli/tests/unit/url_test.ts @@ -35,18 +35,24 @@ Deno.test(function urlParsing() { Deno.test(function urlProtocolParsing() { assertEquals(new URL("Aa+-.1://foo").protocol, "aa+-.1:"); assertEquals(new URL("aA+-.1://foo").protocol, "aa+-.1:"); - assertThrows(() => new URL("1://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("+://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("-://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL(".://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("_://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("=://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("!://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL(`"://foo`), TypeError, "Invalid URL"); - assertThrows(() => new URL("$://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("%://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("^://foo"), TypeError, "Invalid URL"); - assertThrows(() => new URL("*://foo"), TypeError, "Invalid URL"); + assertThrows(() => new URL("1://foo"), TypeError, "Invalid URL: '1://foo'"); + assertThrows(() => new URL("+://foo"), TypeError, "Invalid URL: '+://foo'"); + assertThrows(() => new URL("-://foo"), TypeError, "Invalid URL: '-://foo'"); + assertThrows(() => new URL(".://foo"), TypeError, "Invalid URL: '.://foo'"); + assertThrows(() => new URL("_://foo"), TypeError, "Invalid URL: '_://foo'"); + assertThrows(() => new URL("=://foo"), TypeError, "Invalid URL: '=://foo'"); + assertThrows(() => new URL("!://foo"), TypeError, "Invalid URL: '!://foo'"); + assertThrows(() => new URL(`"://foo`), TypeError, `Invalid URL: '"://foo'`); + assertThrows(() => new URL("$://foo"), TypeError, "Invalid URL: '$://foo'"); + assertThrows(() => new URL("%://foo"), TypeError, "Invalid URL: '%://foo'"); + assertThrows(() => new URL("^://foo"), TypeError, "Invalid URL: '^://foo'"); + assertThrows(() => new URL("*://foo"), TypeError, "Invalid URL: '*://foo'"); + assertThrows(() => new URL("*://foo"), TypeError, "Invalid URL: '*://foo'"); + assertThrows( + () => new URL("!:", "*://foo"), + TypeError, + "Invalid URL: '!:' with base '*://foo'", + ); }); Deno.test(function urlAuthenticationParsing() { |