From 666a0f3a3e79381aeee7e6676d50b5bef9c80947 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 28 May 2018 14:56:13 -0400 Subject: Fix wg ref counting for fetch. --- tests.ts | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'tests.ts') diff --git a/tests.ts b/tests.ts index b2c7ee513..921eeb72c 100644 --- a/tests.ts +++ b/tests.ts @@ -1,13 +1,25 @@ // This test is executed as part of integration_test.go // But it can also be run manually: // ./deno tests.ts +// There must also be a static file http server running on localhost:4545 +// serving the deno project directory. Try this: +// http-server -p 4545 --cors . import { test, assert, assertEqual } from "./deno_testing/testing.ts"; -import { readFileSync, writeFileSync } from "deno"; +import { + readFileSync, + writeFileSync +} from "deno"; test(async function tests_test() { assert(true); }); +test(async function tests_fetch() { + const response = await fetch('http://localhost:4545/package.json'); + const json = await response.json(); + assertEqual(json.name, "deno"); +}); + test(async function tests_readFileSync() { let data = readFileSync("package.json"); if (!data.byteLength) { @@ -33,8 +45,3 @@ test(async function tests_writeFileSync() { assertEqual("Hello", actual); }); -test(async function tests_fetch() { - const response = await fetch("http://localhost:4545/package.json"); - const json = await response.json(); - assertEqual(json.name, "deno"); -}); -- cgit v1.2.3