spec: fix final node and chromium specs after assert change
This commit is contained in:
parent
91f00a518a
commit
40f0f049a2
3 changed files with 18 additions and 6 deletions
|
@ -1,5 +1,16 @@
|
||||||
|
function resolveSingleObjectGetters (object) {
|
||||||
|
if (object && typeof object === 'object') {
|
||||||
|
const newObject = {}
|
||||||
|
for (const key in object) {
|
||||||
|
newObject[key] = resolveGetters(object[key])[0]
|
||||||
|
}
|
||||||
|
return newObject
|
||||||
|
}
|
||||||
|
return object
|
||||||
|
}
|
||||||
|
|
||||||
function resolveGetters (...args) {
|
function resolveGetters (...args) {
|
||||||
return args.map(o => JSON.parse(JSON.stringify(o)))
|
return args.map(resolveSingleObjectGetters)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -7,6 +7,7 @@ const url = require('url')
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
const { ipcRenderer, remote } = require('electron')
|
const { ipcRenderer, remote } = require('electron')
|
||||||
const { closeWindow } = require('./window-helpers')
|
const { closeWindow } = require('./window-helpers')
|
||||||
|
const { resolveGetters } = require('./assert-helpers')
|
||||||
const { app, BrowserWindow, ipcMain, protocol, session, webContents } = remote
|
const { app, BrowserWindow, ipcMain, protocol, session, webContents } = remote
|
||||||
const isCI = remote.getGlobal('isCi')
|
const isCI = remote.getGlobal('isCi')
|
||||||
const features = process.atomBinding('features')
|
const features = process.atomBinding('features')
|
||||||
|
@ -457,8 +458,8 @@ describe('chromium feature', () => {
|
||||||
w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
||||||
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
|
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
|
||||||
assert.strictEqual(options.show, false)
|
assert.strictEqual(options.show, false)
|
||||||
assert.deepStrictEqual(options.foo, {
|
assert.deepStrictEqual(...resolveGetters(options.foo, {
|
||||||
bar: null,
|
bar: undefined,
|
||||||
baz: {
|
baz: {
|
||||||
hello: {
|
hello: {
|
||||||
world: true
|
world: true
|
||||||
|
@ -469,7 +470,7 @@ describe('chromium feature', () => {
|
||||||
world: true
|
world: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}))
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -614,7 +615,7 @@ describe('chromium feature', () => {
|
||||||
|
|
||||||
it('does nothing when origin of current window does not match opener', (done) => {
|
it('does nothing when origin of current window does not match opener', (done) => {
|
||||||
listener = (event) => {
|
listener = (event) => {
|
||||||
assert.strictEqual(event.data, undefined)
|
assert.strictEqual(event.data, null)
|
||||||
done()
|
done()
|
||||||
}
|
}
|
||||||
window.addEventListener('message', listener)
|
window.addEventListener('message', listener)
|
||||||
|
|
|
@ -334,7 +334,7 @@ describe('node feature', () => {
|
||||||
let iv = Buffer.from('0'.repeat(32), 'hex')
|
let iv = Buffer.from('0'.repeat(32), 'hex')
|
||||||
let input = Buffer.from(data, 'base64')
|
let input = Buffer.from(data, 'base64')
|
||||||
let decipher = crypto.createDecipheriv('aes-128-cbc', Buffer.from(key, 'base64'), iv)
|
let decipher = crypto.createDecipheriv('aes-128-cbc', Buffer.from(key, 'base64'), iv)
|
||||||
let result = Buffer.concat([decipher.update(input), decipher.final()])
|
let result = Buffer.concat([decipher.update(input), decipher.final()]).toString('utf8')
|
||||||
assert.strictEqual(cipherText, result)
|
assert.strictEqual(cipherText, result)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue