spec: fix final node and chromium specs after assert change

This commit is contained in:
Samuel Attard 2018-09-14 18:32:17 +10:00
Родитель 91f00a518a
Коммит 40f0f049a2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E89DDE5742D58C4E
3 изменённых файлов: 18 добавлений и 6 удалений

Просмотреть файл

@ -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) {
return args.map(o => JSON.parse(JSON.stringify(o)))
return args.map(resolveSingleObjectGetters)
}
module.exports = {

Просмотреть файл

@ -7,6 +7,7 @@ const url = require('url')
const ChildProcess = require('child_process')
const { ipcRenderer, remote } = require('electron')
const { closeWindow } = require('./window-helpers')
const { resolveGetters } = require('./assert-helpers')
const { app, BrowserWindow, ipcMain, protocol, session, webContents } = remote
const isCI = remote.getGlobal('isCi')
const features = process.atomBinding('features')
@ -457,8 +458,8 @@ describe('chromium feature', () => {
w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
w.webContents.once('new-window', (event, url, frameName, disposition, options) => {
assert.strictEqual(options.show, false)
assert.deepStrictEqual(options.foo, {
bar: null,
assert.deepStrictEqual(...resolveGetters(options.foo, {
bar: undefined,
baz: {
hello: {
world: true
@ -469,7 +470,7 @@ describe('chromium feature', () => {
world: true
}
}
})
}))
done()
})
})
@ -614,7 +615,7 @@ describe('chromium feature', () => {
it('does nothing when origin of current window does not match opener', (done) => {
listener = (event) => {
assert.strictEqual(event.data, undefined)
assert.strictEqual(event.data, null)
done()
}
window.addEventListener('message', listener)

Просмотреть файл

@ -334,7 +334,7 @@ describe('node feature', () => {
let iv = Buffer.from('0'.repeat(32), 'hex')
let input = Buffer.from(data, 'base64')
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)
}
})