Skip to content

Commit

Permalink
test(cli): fix brittle network permission test (denoland#8526)
Browse files Browse the repository at this point in the history
  • Loading branch information
wperron authored Nov 27, 2020
1 parent e2858d0 commit a16adca
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions cli/tests/unit/net_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ unitTest(
unitTest(
{ ignore: Deno.build.os === "windows", perms: { read: true } },
function netUnixListenWritePermission(): void {
try {
assertThrows(() => {
const filePath = Deno.makeTempFileSync();
const socket = Deno.listen({
path: filePath,
Expand All @@ -77,17 +77,14 @@ unitTest(
assert(socket.addr.transport === "unix");
assertEquals(socket.addr.path, filePath);
socket.close();
} catch (e) {
assert(!!e);
assert(e instanceof Deno.errors.PermissionDenied);
}
}, Deno.errors.PermissionDenied);
},
);

unitTest(
{ ignore: Deno.build.os === "windows", perms: { read: true } },
function netUnixPacketListenWritePermission(): void {
try {
assertThrows(() => {
const filePath = Deno.makeTempFileSync();
const socket = Deno.listenDatagram({
path: filePath,
Expand All @@ -96,10 +93,7 @@ unitTest(
assert(socket.addr.transport === "unixpacket");
assertEquals(socket.addr.path, filePath);
socket.close();
} catch (e) {
assert(!!e);
assert(e instanceof Deno.errors.PermissionDenied);
}
}, Deno.errors.PermissionDenied);
},
);

Expand Down

0 comments on commit a16adca

Please sign in to comment.