test: use expect(dir).to.be.an.instanceof(fs.Dirent); (#37331)

This commit is contained in:
Milan Burda 2023-02-19 10:25:40 +01:00 committed by GitHub
parent cf10c19c33
commit 0d8dd61257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -899,7 +899,7 @@ describe('asar package', function () {
const p = path.join(asarDir, 'a.asar');
const dirs = fs.readdirSync(p, { withFileTypes: true });
for (const dir of dirs) {
expect(dir instanceof fs.Dirent).to.be.true();
expect(dir).to.be.an.instanceof(fs.Dirent);
}
const names = dirs.map(a => a.name);
expect(names).to.deep.equal(['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);
@ -909,7 +909,7 @@ describe('asar package', function () {
const p = path.join(asarDir, 'a.asar', 'dir3');
const dirs = fs.readdirSync(p, { withFileTypes: true });
for (const dir of dirs) {
expect(dir instanceof fs.Dirent).to.be.true();
expect(dir).to.be.an.instanceof(fs.Dirent);
}
const names = dirs.map(a => a.name);
expect(names).to.deep.equal(['file1', 'file2', 'file3']);
@ -941,7 +941,7 @@ describe('asar package', function () {
const dirs = await promisify(fs.readdir)(p, { withFileTypes: true });
for (const dir of dirs) {
expect(dir instanceof fs.Dirent).to.be.true();
expect(dir).to.be.an.instanceof(fs.Dirent);
}
const names = dirs.map((a: any) => a.name);
@ -1004,7 +1004,7 @@ describe('asar package', function () {
const p = path.join(asarDir, 'a.asar');
const dirs = await fs.promises.readdir(p, { withFileTypes: true });
for (const dir of dirs) {
expect(dir instanceof fs.Dirent).to.be.true();
expect(dir).to.be.an.instanceof(fs.Dirent);
}
const names = dirs.map(a => a.name);
expect(names).to.deep.equal(['dir1', 'dir2', 'dir3', 'file1', 'file2', 'file3', 'link1', 'link2', 'ping.js']);