diff options
Diffstat (limited to 'cli/tests/unit/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index 359a24e95..2355d0813 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -27,12 +27,37 @@ unitTest( async (): Promise<void> => { await fetch("http://localhost:4000"); }, - Deno.errors.Http, + TypeError, "error trying to connect", ); }, ); +unitTest( + { perms: { net: true } }, + async function fetchDnsError(): Promise<void> { + await assertThrowsAsync( + async (): Promise<void> => { + await fetch("http://nil/"); + }, + TypeError, + "error trying to connect", + ); + }, +); + +unitTest( + { perms: { net: true } }, + async function fetchInvalidUriError(): Promise<void> { + await assertThrowsAsync( + async (): Promise<void> => { + await fetch("http://<invalid>/"); + }, + URIError, + ); + }, +); + unitTest({ perms: { net: true } }, async function fetchJsonSuccess(): Promise< void > { @@ -199,9 +224,12 @@ unitTest({ perms: { net: true } }, async function responseClone(): Promise< unitTest({ perms: { net: true } }, async function fetchEmptyInvalid(): Promise< void > { - await assertThrowsAsync(async () => { - await fetch(""); - }, URIError); + await assertThrowsAsync( + async () => { + await fetch(""); + }, + URIError, + ); }); unitTest( |