From 2dedbdc32710045da422520df75d9a9447a73442 Mon Sep 17 00:00:00 2001 From: Nathan Wallace Date: Mon, 30 Oct 2017 21:10:52 -0500 Subject: [PATCH] fix typo in error reporting --- test/test-jquery-integration.js | 18 ++++++++++++++++++ wrappers/jquery/pubsub.js.post.txt | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/test/test-jquery-integration.js b/test/test-jquery-integration.js index 1c9d09d..ec7c025 100644 --- a/test/test-jquery-integration.js +++ b/test/test-jquery-integration.js @@ -55,6 +55,24 @@ $.pubsub( 'publishSync', topic, data ); assert( mock.verify() ); + }, + + "$.pubsub() reports errors to the console when one is available" : function(){ + var mock = this.mock( global.console ); + mock.expects( 'error' ).once().withArgs( new Error('Method bogus does not exist on jQuery.pubsub') ); + $.pubsub( 'bogus' ); + }, + + "$.pubsub() reports errors with jQuery when the console is not available" : function(){ + var nativeConsole = global.console; + try { + var mock = this.mock( $ ); + global.console = undefined; + mock.expects( 'error' ).once().withArgs( 'Method bogus does not exist on jQuery.pubsub' ); + $.pubsub( 'bogus' ); + } finally { + global.console = nativeConsole; + } } }); }(this)); diff --git a/wrappers/jquery/pubsub.js.post.txt b/wrappers/jquery/pubsub.js.post.txt index acb68e7..b1ebb0a 100644 --- a/wrappers/jquery/pubsub.js.post.txt +++ b/wrappers/jquery/pubsub.js.post.txt @@ -1,5 +1,5 @@ - function reportError(message) { + function reportError(errorMessage) { if (typeof console !== 'undefined'){ console.error(new Error(errorMessage)); return;