diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-04-30 19:24:34 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-30 12:24:34 +0200 |
commit | 74bb09aa38e37603caf81152b48652a0d0972ccd (patch) | |
tree | d80aed7303ef507653335808e705be10bf74b0d4 /cli/tests/unit/url_test.ts | |
parent | 59825a95b4d3952c955b8b43e174189999e35d15 (diff) |
fix(ext/url): throw `TypeError` for empty argument (#18896)
Fixes #18893
Diffstat (limited to 'cli/tests/unit/url_test.ts')
-rw-r--r-- | cli/tests/unit/url_test.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit/url_test.ts b/cli/tests/unit/url_test.ts index 644b8dd39..28cf9a0e2 100644 --- a/cli/tests/unit/url_test.ts +++ b/cli/tests/unit/url_test.ts @@ -32,6 +32,21 @@ Deno.test(function urlParsing() { ); }); +Deno.test(function emptyUrl() { + assertThrows( + // @ts-ignore for test + () => new URL(), + TypeError, + "1 argument required, but only 0 present", + ); + assertThrows( + // @ts-ignore for test + () => URL.canParse(), + TypeError, + "1 argument required, but only 0 present", + ); +}); + Deno.test(function urlProtocolParsing() { assertEquals(new URL("Aa+-.1://foo").protocol, "aa+-.1:"); assertEquals(new URL("aA+-.1://foo").protocol, "aa+-.1:"); |