11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// The following tests validate base functionality for the fs.promises 61cb0ef41Sopenharmony_ci// FileHandle.stat method. 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst { open } = require('fs').promises; 91cb0ef41Sopenharmony_ciconst path = require('path'); 101cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir'); 111cb0ef41Sopenharmony_ciconst assert = require('assert'); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_citmpdir.refresh(); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciasync function validateStat() { 161cb0ef41Sopenharmony_ci const filePath = path.resolve(tmpdir.path, 'tmp-read-file.txt'); 171cb0ef41Sopenharmony_ci const fileHandle = await open(filePath, 'w+'); 181cb0ef41Sopenharmony_ci const stats = await fileHandle.stat(); 191cb0ef41Sopenharmony_ci assert.ok(stats.mtime instanceof Date); 201cb0ef41Sopenharmony_ci await fileHandle.close(); 211cb0ef41Sopenharmony_ci} 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_civalidateStat() 241cb0ef41Sopenharmony_ci .then(common.mustCall()); 25