summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/_fs/_fs_futimes_test.ts
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-01-25 01:59:55 +1100
committerGitHub <noreply@github.com>2024-01-24 15:59:55 +0100
commit62786cfebb5c9fe36d0930582951f442bdfe9441 (patch)
treea1bede5492a5b1bf4a202ee8994df027f098e788 /cli/tests/unit_node/_fs/_fs_futimes_test.ts
parent4af121687cb4c26f4a2f3e4ad266490d8faa3d2d (diff)
feat: deprecate `Deno.close()` (#22066)
For removal in Deno v2. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests/unit_node/_fs/_fs_futimes_test.ts')
-rw-r--r--cli/tests/unit_node/_fs/_fs_futimes_test.ts22
1 files changed, 10 insertions, 12 deletions
diff --git a/cli/tests/unit_node/_fs/_fs_futimes_test.ts b/cli/tests/unit_node/_fs/_fs_futimes_test.ts
index 7df8be5e2..2bfe0175a 100644
--- a/cli/tests/unit_node/_fs/_fs_futimes_test.ts
+++ b/cli/tests/unit_node/_fs/_fs_futimes_test.ts
@@ -12,18 +12,18 @@ Deno.test({
name:
"ASYNC: change the file system timestamps of the object referenced by path",
async fn() {
- const file: string = Deno.makeTempFileSync();
- const { rid } = await Deno.open(file, { create: true, write: true });
+ const filePath = Deno.makeTempFileSync();
+ using file = await Deno.open(filePath, { create: true, write: true });
await new Promise<void>((resolve, reject) => {
- futimes(rid, randomDate, randomDate, (err: Error | null) => {
+ futimes(file.rid, randomDate, randomDate, (err: Error | null) => {
if (err !== null) reject();
else resolve();
});
})
.then(
() => {
- const fileInfo: Deno.FileInfo = Deno.lstatSync(file);
+ const fileInfo: Deno.FileInfo = Deno.lstatSync(filePath);
assertEquals(fileInfo.mtime, randomDate);
assertEquals(fileInfo.atime, randomDate);
},
@@ -32,8 +32,7 @@ Deno.test({
},
)
.finally(() => {
- Deno.removeSync(file);
- Deno.close(rid);
+ Deno.removeSync(filePath);
});
},
});
@@ -68,19 +67,18 @@ Deno.test({
name:
"SYNC: change the file system timestamps of the object referenced by path",
fn() {
- const file: string = Deno.makeTempFileSync();
- const { rid } = Deno.openSync(file, { create: true, write: true });
+ const filePath = Deno.makeTempFileSync();
+ using file = Deno.openSync(filePath, { create: true, write: true });
try {
- futimesSync(rid, randomDate, randomDate);
+ futimesSync(file.rid, randomDate, randomDate);
- const fileInfo: Deno.FileInfo = Deno.lstatSync(file);
+ const fileInfo: Deno.FileInfo = Deno.lstatSync(filePath);
assertEquals(fileInfo.mtime, randomDate);
assertEquals(fileInfo.atime, randomDate);
} finally {
- Deno.removeSync(file);
- Deno.close(rid);
+ Deno.removeSync(filePath);
}
},
});