summaryrefslogtreecommitdiff
path: root/cli/tests/unit/read_file_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/read_file_test.ts')
-rw-r--r--cli/tests/unit/read_file_test.ts30
1 files changed, 12 insertions, 18 deletions
diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts
index d8d1cddf2..f638c7a7c 100644
--- a/cli/tests/unit/read_file_test.ts
+++ b/cli/tests/unit/read_file_test.ts
@@ -8,7 +8,7 @@ import {
unitTest,
} from "./test_util.ts";
-unitTest({ perms: { read: true } }, function readFileSyncSuccess(): void {
+unitTest({ perms: { read: true } }, function readFileSyncSuccess() {
const data = Deno.readFileSync("cli/tests/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
@@ -17,7 +17,7 @@ unitTest({ perms: { read: true } }, function readFileSyncSuccess(): void {
assertEquals(pkg.name, "deno");
});
-unitTest({ perms: { read: true } }, function readFileSyncUrl(): void {
+unitTest({ perms: { read: true } }, function readFileSyncUrl() {
const data = Deno.readFileSync(
pathToAbsoluteFileUrl("cli/tests/fixture.json"),
);
@@ -28,21 +28,19 @@ unitTest({ perms: { read: true } }, function readFileSyncUrl(): void {
assertEquals(pkg.name, "deno");
});
-unitTest({ perms: { read: false } }, function readFileSyncPerm(): void {
+unitTest({ perms: { read: false } }, function readFileSyncPerm() {
assertThrows(() => {
Deno.readFileSync("cli/tests/fixture.json");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, function readFileSyncNotFound(): void {
+unitTest({ perms: { read: true } }, function readFileSyncNotFound() {
assertThrows(() => {
Deno.readFileSync("bad_filename");
}, Deno.errors.NotFound);
});
-unitTest({ perms: { read: true } }, async function readFileUrl(): Promise<
- void
-> {
+unitTest({ perms: { read: true } }, async function readFileUrl() {
const data = await Deno.readFile(
pathToAbsoluteFileUrl("cli/tests/fixture.json"),
);
@@ -53,9 +51,7 @@ unitTest({ perms: { read: true } }, async function readFileUrl(): Promise<
assertEquals(pkg.name, "deno");
});
-unitTest({ perms: { read: true } }, async function readFileSuccess(): Promise<
- void
-> {
+unitTest({ perms: { read: true } }, async function readFileSuccess() {
const data = await Deno.readFile("cli/tests/fixture.json");
assert(data.byteLength > 0);
const decoder = new TextDecoder("utf-8");
@@ -64,15 +60,13 @@ unitTest({ perms: { read: true } }, async function readFileSuccess(): Promise<
assertEquals(pkg.name, "deno");
});
-unitTest({ perms: { read: false } }, async function readFilePerm(): Promise<
- void
-> {
+unitTest({ perms: { read: false } }, async function readFilePerm() {
await assertThrowsAsync(async () => {
await Deno.readFile("cli/tests/fixture.json");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, function readFileSyncLoop(): void {
+unitTest({ perms: { read: true } }, function readFileSyncLoop() {
for (let i = 0; i < 256; i++) {
Deno.readFileSync("cli/tests/fixture.json");
}
@@ -80,7 +74,7 @@ unitTest({ perms: { read: true } }, function readFileSyncLoop(): void {
unitTest(
{ perms: { read: true } },
- async function readFileDoesNotLeakResources(): Promise<void> {
+ async function readFileDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
await assertThrowsAsync(async () => await Deno.readFile("cli"));
assertEquals(resourcesBefore, Deno.resources());
@@ -89,7 +83,7 @@ unitTest(
unitTest(
{ perms: { read: true } },
- function readFileSyncDoesNotLeakResources(): void {
+ function readFileSyncDoesNotLeakResources() {
const resourcesBefore = Deno.resources();
assertThrows(() => Deno.readFileSync("cli"));
assertEquals(resourcesBefore, Deno.resources());
@@ -98,7 +92,7 @@ unitTest(
unitTest(
{ perms: { read: true } },
- async function readFileWithAbortSignal(): Promise<void> {
+ async function readFileWithAbortSignal() {
const ac = new AbortController();
queueMicrotask(() => ac.abort());
await assertThrowsAsync(async () => {
@@ -109,7 +103,7 @@ unitTest(
unitTest(
{ perms: { read: true } },
- async function readTextileWithAbortSignal(): Promise<void> {
+ async function readTextileWithAbortSignal() {
const ac = new AbortController();
queueMicrotask(() => ac.abort());
await assertThrowsAsync(async () => {