From 945dc7b84bc1a05f80b3b4e0b152be38d9f8a9bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 11 Sep 2019 23:34:22 +0200 Subject: fix: panic during fetch (#2925) --- js/fetch_test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'js') diff --git a/js/fetch_test.ts b/js/fetch_test.ts index 77cc010a8..4fcc39f01 100644 --- a/js/fetch_test.ts +++ b/js/fetch_test.ts @@ -4,9 +4,22 @@ import { testPerm, assert, assertEquals, + assertStrContains, assertThrows } from "./test_util.ts"; +testPerm({ net: true }, async function fetchConnectionError(): Promise { + let err; + try { + await fetch("http://localhost:4000"); + } catch (err_) { + err = err_; + } + assertEquals(err.kind, Deno.ErrorKind.HttpOther); + assertEquals(err.name, "HttpOther"); + assertStrContains(err.message, "error trying to connect"); +}); + testPerm({ net: true }, async function fetchJsonSuccess(): Promise { const response = await fetch("http://localhost:4545/package.json"); const json = await response.json(); -- cgit v1.2.3