Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 27921e2

Browse filesBrowse files
Masashi HiranoMylesBorins
authored andcommitted
test: add fs/promises filehandle stat test
Added test for fs/promises filehandle stat. PR-URL: #20492 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d2dd473 commit 27921e2
Copy full SHA for 27921e2

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Collapse file
+24Lines changed: 24 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.