From da6ebac7424e931a5789b95a5b6c70effacfffd1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 9 Feb 2016 13:53:10 -0800 Subject: [PATCH] Use assert.throws --- spec/webview-spec.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 0b6572a5084..eb1427e0855 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.'); }); });