From e58462dbb9b8b611628c5d8da7e523e48a58242c Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Mon, 22 Jan 2024 07:58:24 +1100 Subject: chore: use `Deno.writeTextFile()` where appropriate (#22008) --- cli/tests/unit_node/_fs/_fs_ftruncate_test.ts | 4 ++-- cli/tests/unit_node/_fs/_fs_truncate_test.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'cli/tests/unit_node/_fs') diff --git a/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts b/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts index a843b19b7..4c2c34789 100644 --- a/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts +++ b/cli/tests/unit_node/_fs/_fs_ftruncate_test.ts @@ -24,7 +24,7 @@ Deno.test({ name: "ASYNC: truncate entire file contents", async fn() { const file: string = Deno.makeTempFileSync(); - await Deno.writeFile(file, new TextEncoder().encode("hello world")); + await Deno.writeTextFile(file, "hello world"); const { rid } = await Deno.open(file, { read: true, write: true, @@ -57,7 +57,7 @@ Deno.test({ name: "ASYNC: truncate file to a size of precisely len bytes", async fn() { const file: string = Deno.makeTempFileSync(); - await Deno.writeFile(file, new TextEncoder().encode("hello world")); + await Deno.writeTextFile(file, "hello world"); const { rid } = await Deno.open(file, { read: true, write: true, diff --git a/cli/tests/unit_node/_fs/_fs_truncate_test.ts b/cli/tests/unit_node/_fs/_fs_truncate_test.ts index 00e03ab0e..ff087095b 100644 --- a/cli/tests/unit_node/_fs/_fs_truncate_test.ts +++ b/cli/tests/unit_node/_fs/_fs_truncate_test.ts @@ -24,7 +24,7 @@ Deno.test({ name: "ASYNC: truncate entire file contents", async fn() { const file: string = Deno.makeTempFileSync(); - await Deno.writeFile(file, new TextEncoder().encode("hello world")); + await Deno.writeTextFile(file, "hello world"); await new Promise((resolve, reject) => { truncate(file, (err: Error | null) => { @@ -49,7 +49,7 @@ Deno.test({ name: "ASYNC: truncate file to a size of precisely len bytes", async fn() { const file: string = Deno.makeTempFileSync(); - await Deno.writeFile(file, new TextEncoder().encode("hello world")); + await Deno.writeTextFile(file, "hello world"); await new Promise((resolve, reject) => { truncate(file, 3, (err: Error | null) => { -- cgit v1.2.3