diff options
Diffstat (limited to 'fs/read_json_test.ts')
| -rw-r--r-- | fs/read_json_test.ts | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/fs/read_json_test.ts b/fs/read_json_test.ts index ca32ee053..c8aa6dcf1 100644 --- a/fs/read_json_test.ts +++ b/fs/read_json_test.ts @@ -10,31 +10,37 @@ import * as path from "./path/mod.ts"; const testdataDir = path.resolve("fs", "testdata"); -test(async function readJsonFileNotExists() { +test(async function readJsonFileNotExists(): Promise<void> { const emptyJsonFile = path.join(testdataDir, "json_not_exists.json"); - await assertThrowsAsync(async () => { - await readJson(emptyJsonFile); - }); + await assertThrowsAsync( + async (): Promise<void> => { + await readJson(emptyJsonFile); + } + ); }); -test(async function readEmptyJsonFile() { +test(async function readEmptyJsonFile(): Promise<void> { const emptyJsonFile = path.join(testdataDir, "json_empty.json"); - await assertThrowsAsync(async () => { - await readJson(emptyJsonFile); - }); + await assertThrowsAsync( + async (): Promise<void> => { + await readJson(emptyJsonFile); + } + ); }); -test(async function readInvalidJsonFile() { +test(async function readInvalidJsonFile(): Promise<void> { const invalidJsonFile = path.join(testdataDir, "json_invalid.json"); - await assertThrowsAsync(async () => { - await readJson(invalidJsonFile); - }); + await assertThrowsAsync( + async (): Promise<void> => { + await readJson(invalidJsonFile); + } + ); }); -test(async function readValidArrayJsonFile() { +test(async function readValidArrayJsonFile(): Promise<void> { const invalidJsonFile = path.join(testdataDir, "json_valid_array.json"); const json = await readJson(invalidJsonFile); @@ -42,7 +48,7 @@ test(async function readValidArrayJsonFile() { assertEquals(json, ["1", "2", "3"]); }); -test(async function readValidObjJsonFile() { +test(async function readValidObjJsonFile(): Promise<void> { const invalidJsonFile = path.join(testdataDir, "json_valid_obj.json"); const json = await readJson(invalidJsonFile); @@ -50,37 +56,43 @@ test(async function readValidObjJsonFile() { assertEquals(json, { key1: "value1", key2: "value2" }); }); -test(async function readValidObjJsonFileWithRelativePath() { +test(async function readValidObjJsonFileWithRelativePath(): Promise<void> { const json = await readJson("./fs/testdata/json_valid_obj.json"); assertEquals(json, { key1: "value1", key2: "value2" }); }); -test(function readJsonFileNotExistsSync() { +test(function readJsonFileNotExistsSync(): void { const emptyJsonFile = path.join(testdataDir, "json_not_exists.json"); - assertThrows(() => { - readJsonSync(emptyJsonFile); - }); + assertThrows( + (): void => { + readJsonSync(emptyJsonFile); + } + ); }); -test(function readEmptyJsonFileSync() { +test(function readEmptyJsonFileSync(): void { const emptyJsonFile = path.join(testdataDir, "json_empty.json"); - assertThrows(() => { - readJsonSync(emptyJsonFile); - }); + assertThrows( + (): void => { + readJsonSync(emptyJsonFile); + } + ); }); -test(function readInvalidJsonFile() { +test(function readInvalidJsonFile(): void { const invalidJsonFile = path.join(testdataDir, "json_invalid.json"); - assertThrows(() => { - readJsonSync(invalidJsonFile); - }); + assertThrows( + (): void => { + readJsonSync(invalidJsonFile); + } + ); }); -test(function readValidArrayJsonFileSync() { +test(function readValidArrayJsonFileSync(): void { const invalidJsonFile = path.join(testdataDir, "json_valid_array.json"); const json = readJsonSync(invalidJsonFile); @@ -88,7 +100,7 @@ test(function readValidArrayJsonFileSync() { assertEquals(json, ["1", "2", "3"]); }); -test(function readValidObjJsonFileSync() { +test(function readValidObjJsonFileSync(): void { const invalidJsonFile = path.join(testdataDir, "json_valid_obj.json"); const json = readJsonSync(invalidJsonFile); @@ -96,7 +108,7 @@ test(function readValidObjJsonFileSync() { assertEquals(json, { key1: "value1", key2: "value2" }); }); -test(function readValidObjJsonFileSyncWithRelativePath() { +test(function readValidObjJsonFileSyncWithRelativePath(): void { const json = readJsonSync("./fs/testdata/json_valid_obj.json"); assertEquals(json, { key1: "value1", key2: "value2" }); |
