Skip to content

Commit 27921e2

Browse files
Masashi HiranoMylesBorins
Masashi Hirano
authored andcommitted
test: add fs/promises filehandle stat test
Added test for fs/promises filehandle stat. PR-URL: #20492 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d2dd473 commit 27921e2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
5+
// The following tests validate base functionality for the fs/promises
6+
// FileHandle.stat method.
7+
8+
const { open } = require('fs/promises');
9+
const path = require('path');
10+
const tmpdir = require('../common/tmpdir');
11+
const assert = require('assert');
12+
13+
tmpdir.refresh();
14+
common.crashOnUnhandledRejection();
15+
16+
async function validateStat() {
17+
const filePath = path.resolve(tmpdir.path, 'tmp-read-file.txt');
18+
const fileHandle = await open(filePath, 'w+');
19+
const stats = await fileHandle.stat();
20+
assert.ok(stats.mtime instanceof Date);
21+
}
22+
23+
validateStat()
24+
.then(common.mustCall());

0 commit comments

Comments
 (0)