diff options
Diffstat (limited to 'cli/tests/unit/tls_test.ts')
-rw-r--r-- | cli/tests/unit/tls_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts index ba1f067de..fa869037e 100644 --- a/cli/tests/unit/tls_test.ts +++ b/cli/tests/unit/tls_test.ts @@ -20,6 +20,24 @@ unitTest(async function connectTLSNoPerm(): Promise<void> { }, Deno.errors.PermissionDenied); }); +unitTest( + { perms: { read: true, net: true } }, + async function connectTLSInvalidHost(): Promise<void> { + const listener = await Deno.listenTls({ + hostname: "localhost", + port: 3567, + certFile: "cli/tests/tls/localhost.crt", + keyFile: "cli/tests/tls/localhost.key", + }); + + await assertThrowsAsync(async () => { + await Deno.connectTls({ hostname: "127.0.0.1", port: 3567 }); + }, Error); + + listener.close(); + }, +); + unitTest(async function connectTLSCertFileNoReadPerm(): Promise<void> { await assertThrowsAsync(async () => { await Deno.connectTls({ |