mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
74e0ca3f49
PR-URL: https://github.com/nodejs/node/pull/49125 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
24 lines
585 B
JavaScript
24 lines
585 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
// The following tests validate base functionality for the fs.promises
|
|
// FileHandle.stat method.
|
|
|
|
const { open } = require('fs').promises;
|
|
const tmpdir = require('../common/tmpdir');
|
|
const assert = require('assert');
|
|
|
|
tmpdir.refresh();
|
|
|
|
async function validateStat() {
|
|
const filePath = tmpdir.resolve('tmp-read-file.txt');
|
|
const fileHandle = await open(filePath, 'w+');
|
|
const stats = await fileHandle.stat();
|
|
assert.ok(stats.mtime instanceof Date);
|
|
await fileHandle.close();
|
|
}
|
|
|
|
validateStat()
|
|
.then(common.mustCall());
|