summaryrefslogtreecommitdiff
path: root/std/fs/copy_test.ts
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2020-04-27 20:09:56 +0200
committerBert Belder <bertbelder@gmail.com>2020-04-27 21:13:32 +0200
commitee4e6a1ef9f51beaaef5e189302afe1db68ff6c1 (patch)
treed0a94be76718630b210c481e9b0f3171542b4007 /std/fs/copy_test.ts
parentc190a0dbc48e7de6a63a2f633f59054d40800600 (diff)
Rename FileInfo time fields and represent them as Date objects (#4932)
This patch also increases the resolution of reported file times to sub-millisecond precision.
Diffstat (limited to 'std/fs/copy_test.ts')
-rw-r--r--std/fs/copy_test.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/std/fs/copy_test.ts b/std/fs/copy_test.ts
index 65e36a5fc..5323ac9e4 100644
--- a/std/fs/copy_test.ts
+++ b/std/fs/copy_test.ts
@@ -143,8 +143,8 @@ testCopy(
const srcStatInfo = await Deno.stat(srcFile);
- assert(typeof srcStatInfo.accessed === "number");
- assert(typeof srcStatInfo.modified === "number");
+ assert(srcStatInfo.atime instanceof Date);
+ assert(srcStatInfo.mtime instanceof Date);
// Copy with overwrite and preserve timestamps options.
await copy(srcFile, destFile, {
@@ -154,10 +154,10 @@ testCopy(
const destStatInfo = await Deno.stat(destFile);
- assert(typeof destStatInfo.accessed === "number");
- assert(typeof destStatInfo.modified === "number");
- assertEquals(destStatInfo.accessed, srcStatInfo.accessed);
- assertEquals(destStatInfo.modified, srcStatInfo.modified);
+ assert(destStatInfo.atime instanceof Date);
+ assert(destStatInfo.mtime instanceof Date);
+ assertEquals(destStatInfo.atime, srcStatInfo.atime);
+ assertEquals(destStatInfo.mtime, srcStatInfo.mtime);
}
);
@@ -327,8 +327,8 @@ testCopySync(
const srcStatInfo = Deno.statSync(srcFile);
- assert(typeof srcStatInfo.accessed === "number");
- assert(typeof srcStatInfo.modified === "number");
+ assert(srcStatInfo.atime instanceof Date);
+ assert(srcStatInfo.mtime instanceof Date);
// Copy with overwrite and preserve timestamps options.
copySync(srcFile, destFile, {
@@ -338,12 +338,12 @@ testCopySync(
const destStatInfo = Deno.statSync(destFile);
- assert(typeof destStatInfo.accessed === "number");
- assert(typeof destStatInfo.modified === "number");
+ assert(destStatInfo.atime instanceof Date);
+ assert(destStatInfo.mtime instanceof Date);
// TODO: Activate test when https://github.com/denoland/deno/issues/2411
// is fixed
- // assertEquals(destStatInfo.accessed, srcStatInfo.accessed);
- // assertEquals(destStatInfo.modified, srcStatInfo.modified);
+ // assertEquals(destStatInfo.atime, srcStatInfo.atime);
+ // assertEquals(destStatInfo.mtime, srcStatInfo.mtime);
}
);