summaryrefslogtreecommitdiff
path: root/fs/ensure_file_test.ts
diff options
context:
space:
mode:
authorVincent LE GOFF <g_n_s@hotmail.fr>2019-04-24 13:41:23 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-04-24 07:41:22 -0400
commitdcd01dd02530df0e799eb4227087680ffeb80d74 (patch)
tree8cc1dec75dd17c326fea6d7fe471b7e7a31032f7 /fs/ensure_file_test.ts
parente1f7a60bb326f8299f339635c0738d28431afa0a (diff)
Eslint fixes (denoland/deno_std#356)
Make warnings fail Original: https://github.com/denoland/deno_std/commit/4543b563a9a01c8c168aafcbfd9d4634effba7fc
Diffstat (limited to 'fs/ensure_file_test.ts')
-rw-r--r--fs/ensure_file_test.ts64
1 files changed, 38 insertions, 26 deletions
diff --git a/fs/ensure_file_test.ts b/fs/ensure_file_test.ts
index fd3f4718a..fa27133ab 100644
--- a/fs/ensure_file_test.ts
+++ b/fs/ensure_file_test.ts
@@ -6,36 +6,42 @@ import * as path from "./path/mod.ts";
const testdataDir = path.resolve("fs", "testdata");
-test(async function ensureFileIfItNotExist() {
+test(async function ensureFileIfItNotExist(): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_1");
const testFile = path.join(testDir, "test.txt");
await ensureFile(testFile);
- await assertThrowsAsync(async () => {
- await Deno.stat(testFile).then(() => {
- throw new Error("test file should exists.");
- });
- });
+ await assertThrowsAsync(
+ async (): Promise<void> => {
+ await Deno.stat(testFile).then(
+ (): void => {
+ throw new Error("test file should exists.");
+ }
+ );
+ }
+ );
await Deno.remove(testDir, { recursive: true });
});
-test(function ensureFileSyncIfItNotExist() {
+test(function ensureFileSyncIfItNotExist(): void {
const testDir = path.join(testdataDir, "ensure_file_2");
const testFile = path.join(testDir, "test.txt");
ensureFileSync(testFile);
- assertThrows(() => {
- Deno.statSync(testFile);
- throw new Error("test file should exists.");
- });
+ assertThrows(
+ (): void => {
+ Deno.statSync(testFile);
+ throw new Error("test file should exists.");
+ }
+ );
Deno.removeSync(testDir, { recursive: true });
});
-test(async function ensureFileIfItExist() {
+test(async function ensureFileIfItExist(): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_3");
const testFile = path.join(testDir, "test.txt");
@@ -44,16 +50,20 @@ test(async function ensureFileIfItExist() {
await ensureFile(testFile);
- await assertThrowsAsync(async () => {
- await Deno.stat(testFile).then(() => {
- throw new Error("test file should exists.");
- });
- });
+ await assertThrowsAsync(
+ async (): Promise<void> => {
+ await Deno.stat(testFile).then(
+ (): void => {
+ throw new Error("test file should exists.");
+ }
+ );
+ }
+ );
await Deno.remove(testDir, { recursive: true });
});
-test(function ensureFileSyncIfItExist() {
+test(function ensureFileSyncIfItExist(): void {
const testDir = path.join(testdataDir, "ensure_file_4");
const testFile = path.join(testDir, "test.txt");
@@ -62,21 +72,23 @@ test(function ensureFileSyncIfItExist() {
ensureFileSync(testFile);
- assertThrows(() => {
- Deno.statSync(testFile);
- throw new Error("test file should exists.");
- });
+ assertThrows(
+ (): void => {
+ Deno.statSync(testFile);
+ throw new Error("test file should exists.");
+ }
+ );
Deno.removeSync(testDir, { recursive: true });
});
-test(async function ensureFileIfItExistAsDir() {
+test(async function ensureFileIfItExistAsDir(): Promise<void> {
const testDir = path.join(testdataDir, "ensure_file_5");
await Deno.mkdir(testDir, true);
await assertThrowsAsync(
- async () => {
+ async (): Promise<void> => {
await ensureFile(testDir);
},
Error,
@@ -86,13 +98,13 @@ test(async function ensureFileIfItExistAsDir() {
await Deno.remove(testDir, { recursive: true });
});
-test(function ensureFileSyncIfItExistAsDir() {
+test(function ensureFileSyncIfItExistAsDir(): void {
const testDir = path.join(testdataDir, "ensure_file_6");
Deno.mkdirSync(testDir, true);
assertThrows(
- () => {
+ (): void => {
ensureFileSync(testDir);
},
Error,