2018-05-03 15:18:38 +09:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
|
2018-05-03 14:40:48 -04:00
|
|
|
// The following tests validate base functionality for the fs.promises
|
2018-05-03 15:18:38 +09:00
|
|
|
// FileHandle.stat method.
|
|
|
|
|
2018-05-03 14:40:48 -04:00
|
|
|
const { open } = require('fs').promises;
|
2018-05-03 15:18:38 +09:00
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
tmpdir.refresh();
|
|
|
|
|
|
|
|
async function validateStat() {
|
2023-08-15 22:45:14 +09:00
|
|
|
const filePath = tmpdir.resolve('tmp-read-file.txt');
|
2018-05-03 15:18:38 +09:00
|
|
|
const fileHandle = await open(filePath, 'w+');
|
|
|
|
const stats = await fileHandle.stat();
|
|
|
|
assert.ok(stats.mtime instanceof Date);
|
2019-07-30 07:50:21 +01:00
|
|
|
await fileHandle.close();
|
2018-05-03 15:18:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
validateStat()
|
|
|
|
.then(common.mustCall());
|