Skip to content

Commit

Permalink
spec: fix final node and chromium specs after assert change
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Sep 14, 2018
1 parent 91f00a5 commit 40f0f04
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
13 changes: 12 additions & 1 deletion spec/assert-helpers.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
9 changes: 5 additions & 4 deletions spec/chromium-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -469,7 +470,7 @@ describe('chromium feature', () => {
world: true
}
}
})
}))
done()
})
})
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spec/node-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})
Expand Down

0 comments on commit 40f0f04

Please sign in to comment.