add assertResources sanitizer to cli/js/ unit tests (#4161)

This commit is contained in:
Bartek Iwańczuk 2020-02-29 18:45:47 +01:00 committed by GitHub
parent 199fb195f3
commit f55b22e195
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 95 additions and 36 deletions

View file

@ -1,5 +1,11 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { test, testPerm, assert, assertEquals } from "./test_util.ts";
import {
test,
testPerm,
assert,
assertEquals,
createResolvable
} from "./test_util.ts";
import { BufWriter, BufReader } from "../../std/io/bufio.ts";
import { TextProtoReader } from "../../std/textproto/mod.ts";
@ -142,6 +148,7 @@ testPerm(
testPerm({ read: true, net: true }, async function dialAndListenTLS(): Promise<
void
> {
const resolvable = createResolvable();
const hostname = "localhost";
const port = 4500;
@ -164,6 +171,7 @@ testPerm({ read: true, net: true }, async function dialAndListenTLS(): Promise<
// TODO(bartlomieju): this might be a bug
setTimeout(() => {
conn.close();
resolvable.resolve();
}, 0);
}
);
@ -196,4 +204,6 @@ testPerm({ read: true, net: true }, async function dialAndListenTLS(): Promise<
await r.readFull(bodyBuf);
assertEquals(decoder.decode(bodyBuf), "Hello World\n");
conn.close();
listener.close();
await resolvable;
});