From: Kevin Sawicki Date: Tue, 9 Feb 2016 21:53:10 +0000 (-0800) Subject: Use assert.throws X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=4b98d3a0d470f26bd32a3bd75185a4af84e217ff;p=electron.git Use assert.throws --- diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 0b6572a5..eb1427e0 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -563,14 +563,9 @@ describe(' tag', function() { }); it('throws a custom error when an API method is called before the event is emitted', function() { - var readyError = null; - try { - webview.stop(); - } catch (error) { - readyError = error; - } - - assert.equal(readyError.message, 'Cannot call stop because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emmitted before this method can be called.'); + assert.throws(function () { + webview.stop() + }, 'Cannot call stop because the webContents is unavailable. The WebView must be attached to the DOM and the dom-ready event emmitted before this method can be called.'); }); });