Update some tests (#12917)

* Use Chai for webview tests

* Slightly rewrite one of the <webview> tests

"dom-ready event" > "throws a custom error..."

* Use Chai for BrowserWindow tests

* Rewrite BrowserWindow.addDevToolsExtension tests
This commit is contained in:
Alexey Kuzmin 2018-05-14 21:17:31 +03:00 committed by Charles Kerr
parent fe7947da90
commit d5dfb19508
2 changed files with 100 additions and 56 deletions

View file

@ -1,4 +1,5 @@
const assert = require('assert')
const {expect} = require('chai')
const path = require('path')
const http = require('http')
const url = require('url')
@ -846,9 +847,11 @@ describe('<webview> tag', function () {
})
it('throws a custom error when an API method is called before the event is emitted', () => {
assert.throws(() => {
webview.stop()
}, 'Cannot call stop because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emitted before this method can be called.')
const expectedErrorMessage =
'Cannot call stop because the webContents is unavailable. ' +
'The WebView must be attached to the DOM ' +
'and the dom-ready event emitted before this method can be called.'
expect(() => { webview.stop() }).to.throw(expectedErrorMessage)
})
})