test: refactor the "util.promisify" test (#14491)
This commit is contained in:
parent
8e963f10ef
commit
c7bec13069
1 changed files with 6 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
||||||
const assert = require('assert')
|
const assert = require('assert')
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
|
const {expect} = require('chai')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const util = require('util')
|
const util = require('util')
|
||||||
|
@ -891,10 +892,12 @@ describe('asar package', function () {
|
||||||
describe('util.promisify', function () {
|
describe('util.promisify', function () {
|
||||||
it('can promisify all fs functions', function () {
|
it('can promisify all fs functions', function () {
|
||||||
const originalFs = require('original-fs')
|
const originalFs = require('original-fs')
|
||||||
|
const {hasOwnProperty} = Object.prototype
|
||||||
|
|
||||||
for (const key in originalFs) {
|
for (const [propertyName, originalValue] of Object.entries(originalFs)) {
|
||||||
if (originalFs[key][util.promisify.custom] && !fs[key][util.promisify.custom]) {
|
if (hasOwnProperty.call(originalValue, util.promisify.custom)) {
|
||||||
assert(false, `fs.${key}[util.promisify.custom] missing`)
|
expect(fs).to.have.own.property(propertyName)
|
||||||
|
.that.has.own.property(util.promisify.custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue