diff options
Diffstat (limited to 'std/node')
-rw-r--r-- | std/node/_fs/_fs_appendFile_test.ts | 12 | ||||
-rw-r--r-- | std/node/_fs/_fs_open_test.ts | 18 | ||||
-rw-r--r-- | std/node/_fs/_fs_stat.ts | 22 | ||||
-rw-r--r-- | std/node/_fs/_fs_stat_test.ts | 24 |
4 files changed, 38 insertions, 38 deletions
diff --git a/std/node/_fs/_fs_appendFile_test.ts b/std/node/_fs/_fs_appendFile_test.ts index f16b61599..5d9e6f96d 100644 --- a/std/node/_fs/_fs_appendFile_test.ts +++ b/std/node/_fs/_fs_appendFile_test.ts @@ -211,11 +211,11 @@ Deno.test({ name: "Sync: Data is written in Uint8Array to passed in file path", fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); - const test_data = new TextEncoder().encode("hello world"); - appendFileSync("_fs_appendFile_test_file_sync.txt", test_data); + const testData = new TextEncoder().encode("hello world"); + appendFileSync("_fs_appendFile_test_file_sync.txt", testData); assertEquals(Deno.resources(), openResourcesBeforeAppend); const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt"); - assertEquals(data, test_data); + assertEquals(data, testData); Deno.removeSync("_fs_appendFile_test_file_sync.txt"); }, }); @@ -224,9 +224,9 @@ Deno.test({ name: "Async: Data is written in Uint8Array to passed in file path", async fn() { const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources(); - const test_data = new TextEncoder().encode("hello world"); + const testData = new TextEncoder().encode("hello world"); await new Promise((resolve, reject) => { - appendFile("_fs_appendFile_test_file.txt", test_data, (err) => { + appendFile("_fs_appendFile_test_file.txt", testData, (err) => { if (err) reject(err); else resolve(); }); @@ -234,7 +234,7 @@ Deno.test({ .then(async () => { assertEquals(Deno.resources(), openResourcesBeforeAppend); const data = await Deno.readFile("_fs_appendFile_test_file.txt"); - assertEquals(data, test_data); + assertEquals(data, testData); }) .catch((err) => { fail("No error was expected: " + err); diff --git a/std/node/_fs/_fs_open_test.ts b/std/node/_fs/_fs_open_test.ts index 4cbd58d02..16f60110e 100644 --- a/std/node/_fs/_fs_open_test.ts +++ b/std/node/_fs/_fs_open_test.ts @@ -9,7 +9,7 @@ import { join, parse } from "../../path/mod.ts"; import { existsSync } from "../../fs/mod.ts"; import { closeSync } from "./_fs_close.ts"; -const temp_dir = parse(Deno.makeTempFileSync()).dir; +const tempDir = parse(Deno.makeTempFileSync()).dir; Deno.test({ name: "ASYNC: open file", @@ -44,7 +44,7 @@ Deno.test({ Deno.test({ name: "open with flag 'a'", fn() { - const file = join(temp_dir, "some_random_file"); + const file = join(tempDir, "some_random_file"); const fd = openSync(file, "a"); assertEquals(typeof fd, "number"); assertEquals(existsSync(file), true); @@ -71,7 +71,7 @@ Deno.test({ Deno.test({ name: "open with flag 'a+'", fn() { - const file = join(temp_dir, "some_random_file2"); + const file = join(tempDir, "some_random_file2"); const fd = openSync(file, "a+"); assertEquals(typeof fd, "number"); assertEquals(existsSync(file), true); @@ -97,7 +97,7 @@ Deno.test({ Deno.test({ name: "open with flag 'as'", fn() { - const file = join(temp_dir, "some_random_file10"); + const file = join(tempDir, "some_random_file10"); const fd = openSync(file, "as"); assertEquals(existsSync(file), true); assertEquals(typeof fd, "number"); @@ -108,7 +108,7 @@ Deno.test({ Deno.test({ name: "open with flag 'as+'", fn() { - const file = join(temp_dir, "some_random_file10"); + const file = join(tempDir, "some_random_file10"); const fd = openSync(file, "as+"); assertEquals(existsSync(file), true); assertEquals(typeof fd, "number"); @@ -119,7 +119,7 @@ Deno.test({ Deno.test({ name: "open with flag 'r'", fn() { - const file = join(temp_dir, "some_random_file3"); + const file = join(tempDir, "some_random_file3"); assertThrows(() => { openSync(file, "r"); }, Error); @@ -129,7 +129,7 @@ Deno.test({ Deno.test({ name: "open with flag 'r+'", fn() { - const file = join(temp_dir, "some_random_file4"); + const file = join(tempDir, "some_random_file4"); assertThrows(() => { openSync(file, "r+"); }, Error); @@ -146,7 +146,7 @@ Deno.test({ assertEquals(Deno.readTextFileSync(file), ""); closeSync(fd); - const file2 = join(temp_dir, "some_random_file5"); + const file2 = join(tempDir, "some_random_file5"); const fd2 = openSync(file2, "w"); assertEquals(typeof fd2, "number"); assertEquals(existsSync(file2), true); @@ -185,7 +185,7 @@ Deno.test({ assertEquals(Deno.readTextFileSync(file), ""); closeSync(fd); - const file2 = join(temp_dir, "some_random_file6"); + const file2 = join(tempDir, "some_random_file6"); const fd2 = openSync(file2, "w+"); assertEquals(typeof fd2, "number"); assertEquals(existsSync(file2), true); diff --git a/std/node/_fs/_fs_stat.ts b/std/node/_fs/_fs_stat.ts index d823f7ddb..3ca2a9918 100644 --- a/std/node/_fs/_fs_stat.ts +++ b/std/node/_fs/_fs_stat.ts @@ -183,7 +183,7 @@ export function convertFileInfoToStats(origin: Deno.FileInfo): Stats { }; } -function to_BigInt(number?: number | null) { +function toBigInt(number?: number | null) { if (number === null || number === undefined) return null; return BigInt(number); } @@ -192,16 +192,16 @@ export function convertFileInfoToBigIntStats( origin: Deno.FileInfo, ): BigIntStats { return { - dev: to_BigInt(origin.dev), - ino: to_BigInt(origin.ino), - mode: to_BigInt(origin.mode), - nlink: to_BigInt(origin.nlink), - uid: to_BigInt(origin.uid), - gid: to_BigInt(origin.gid), - rdev: to_BigInt(origin.rdev), - size: to_BigInt(origin.size) || 0n, - blksize: to_BigInt(origin.blksize), - blocks: to_BigInt(origin.blocks), + dev: toBigInt(origin.dev), + ino: toBigInt(origin.ino), + mode: toBigInt(origin.mode), + nlink: toBigInt(origin.nlink), + uid: toBigInt(origin.uid), + gid: toBigInt(origin.gid), + rdev: toBigInt(origin.rdev), + size: toBigInt(origin.size) || 0n, + blksize: toBigInt(origin.blksize), + blocks: toBigInt(origin.blocks), mtime: origin.mtime, atime: origin.atime, birthtime: origin.birthtime, diff --git a/std/node/_fs/_fs_stat_test.ts b/std/node/_fs/_fs_stat_test.ts index 925a79be2..3ba8d1cb2 100644 --- a/std/node/_fs/_fs_stat_test.ts +++ b/std/node/_fs/_fs_stat_test.ts @@ -24,7 +24,7 @@ export function assertStats(actual: Stats, expected: Deno.FileInfo) { assertEquals(actual.isSymbolicLink(), expected.isSymlink); } -function to_BigInt(num?: number | null) { +function toBigInt(num?: number | null) { if (num === undefined || num === null) return null; return BigInt(num); } @@ -33,17 +33,17 @@ export function assertStatsBigInt( actual: BigIntStats, expected: Deno.FileInfo, ) { - assertEquals(actual.dev, to_BigInt(expected.dev)); - assertEquals(actual.gid, to_BigInt(expected.gid)); - assertEquals(actual.size, to_BigInt(expected.size)); - assertEquals(actual.blksize, to_BigInt(expected.blksize)); - assertEquals(actual.blocks, to_BigInt(expected.blocks)); - assertEquals(actual.ino, to_BigInt(expected.ino)); - assertEquals(actual.gid, to_BigInt(expected.gid)); - assertEquals(actual.mode, to_BigInt(expected.mode)); - assertEquals(actual.nlink, to_BigInt(expected.nlink)); - assertEquals(actual.rdev, to_BigInt(expected.rdev)); - assertEquals(actual.uid, to_BigInt(expected.uid)); + assertEquals(actual.dev, toBigInt(expected.dev)); + assertEquals(actual.gid, toBigInt(expected.gid)); + assertEquals(actual.size, toBigInt(expected.size)); + assertEquals(actual.blksize, toBigInt(expected.blksize)); + assertEquals(actual.blocks, toBigInt(expected.blocks)); + assertEquals(actual.ino, toBigInt(expected.ino)); + assertEquals(actual.gid, toBigInt(expected.gid)); + assertEquals(actual.mode, toBigInt(expected.mode)); + assertEquals(actual.nlink, toBigInt(expected.nlink)); + assertEquals(actual.rdev, toBigInt(expected.rdev)); + assertEquals(actual.uid, toBigInt(expected.uid)); assertEquals(actual.atime?.getTime(), expected.atime?.getTime()); assertEquals(actual.mtime?.getTime(), expected.mtime?.getTime()); assertEquals(actual.birthtime?.getTime(), expected.birthtime?.getTime()); |