diff options
Diffstat (limited to 'cli/js/url_test.ts')
-rw-r--r-- | cli/js/url_test.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/js/url_test.ts b/cli/js/url_test.ts index 23f9f5f4b..1f8e31999 100644 --- a/cli/js/url_test.ts +++ b/cli/js/url_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { test, assert, assertEquals } from "./test_util.ts"; +import { test, assert, assertEquals, assertThrows } from "./test_util.ts"; test(function urlParsing(): void { const url = new URL( @@ -187,3 +187,16 @@ test(function customInspectFunction(): void { 'URL { href: "http://example.com/?", origin: "http://example.com", protocol: "http:", username: "", password: "", host: "example.com", hostname: "example.com", port: "", pathname: "/", hash: "", search: "?" }' ); }); + +test(function protocolNotHttpOrFile() { + const url = new URL("about:blank"); + assertEquals(url.href, "about:blank"); + assertEquals(url.protocol, "about:"); + assertEquals(url.origin, "null"); +}); + +test(function createBadUrl(): void { + assertThrows(() => { + new URL("0.0.0.0:8080"); + }); +}); |