Skip to content

Commit

Permalink
test: fix fs test-fs-utimes strictEqual arg order
Browse files Browse the repository at this point in the history
`actual` is the first argument, `expected` the second, but the test
flipped them around and was producing confusing assertion messages
as a result.

Refs: #32408 (comment)

PR-URL: #32420
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
bnoordhuis authored and targos committed Apr 11, 2020
1 parent 991aca3 commit 2e015e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-fs-utimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ if (!process.arch.includes('arm') &&
const Y2K38_mtime = 2 ** 31;
fs.utimesSync(path, Y2K38_mtime, Y2K38_mtime);
const Y2K38_stats = fs.statSync(path);
assert.strictEqual(Y2K38_mtime, Y2K38_stats.mtime.getTime() / 1000);
assert.strictEqual(Y2K38_stats.mtime.getTime() / 1000, Y2K38_mtime);
}

if (common.isWindows) {
// This value would get converted to (double)1713037251359.9998
const truncate_mtime = 1713037251360;
fs.utimesSync(path, truncate_mtime / 1000, truncate_mtime / 1000);
const truncate_stats = fs.statSync(path);
assert.strictEqual(truncate_mtime, truncate_stats.mtime.getTime());
assert.strictEqual(truncate_stats.mtime.getTime(), truncate_mtime);

// test Y2K38 for windows
// This value if treaded as a `signed long` gets converted to -2135622133469.
Expand All @@ -168,7 +168,7 @@ if (common.isWindows) {
const overflow_mtime = 2159345162531;
fs.utimesSync(path, overflow_mtime / 1000, overflow_mtime / 1000);
const overflow_stats = fs.statSync(path);
assert.strictEqual(overflow_mtime, overflow_stats.mtime.getTime());
assert.strictEqual(overflow_stats.mtime.getTime(), overflow_mtime);
}

const expectTypeError = {
Expand Down

0 comments on commit 2e015e5

Please sign in to comment.