summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/_fs/_fs_write_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit_node/_fs/_fs_write_test.ts')
-rw-r--r--cli/tests/unit_node/_fs/_fs_write_test.ts6
1 files changed, 2 insertions, 4 deletions
diff --git a/cli/tests/unit_node/_fs/_fs_write_test.ts b/cli/tests/unit_node/_fs/_fs_write_test.ts
index 2c5c3d58e..ef538e9e4 100644
--- a/cli/tests/unit_node/_fs/_fs_write_test.ts
+++ b/cli/tests/unit_node/_fs/_fs_write_test.ts
@@ -9,7 +9,7 @@ Deno.test({
name: "Data is written to the file with the correct length",
async fn() {
const tempFile: string = await Deno.makeTempFile();
- const file: Deno.FsFile = await Deno.open(tempFile, {
+ using file = await Deno.open(tempFile, {
create: true,
write: true,
read: true,
@@ -21,7 +21,6 @@ Deno.test({
resolve(nwritten);
});
});
- Deno.close(file.rid);
const data = await Deno.readFile(tempFile);
await Deno.remove(tempFile);
@@ -35,14 +34,13 @@ Deno.test({
name: "Data is written synchronously to the file with the correct length",
fn() {
const tempFile: string = Deno.makeTempFileSync();
- const file: Deno.FsFile = Deno.openSync(tempFile, {
+ using file = Deno.openSync(tempFile, {
create: true,
write: true,
read: true,
});
const buffer = Buffer.from("hello world");
const bytesWrite = writeSync(file.rid, buffer, 0, 5);
- Deno.close(file.rid);
const data = Deno.readFileSync(tempFile);
Deno.removeSync(tempFile);