From 9f7b036aacd2e8e5ed4b27d2744c23c9e00b899e Mon Sep 17 00:00:00 2001 From: John Tran Date: Wed, 24 Feb 2021 11:12:35 -0800 Subject: [PATCH] fix: remove only test and small robustness regression (#357) * test: remove only test * fix issues with tests * remove nocompats Co-authored-by: Kelvin Lu --- src/amplitude-client.js | 6 +++--- src/utils.js | 2 +- test/amplitude-client.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amplitude-client.js b/src/amplitude-client.js index 607029fc..c9644e95 100644 --- a/src/amplitude-client.js +++ b/src/amplitude-client.js @@ -1140,7 +1140,7 @@ AmplitudeClient.prototype.identify = function (identify_obj, opt_callback) { } // if identify input is a proxied object created by the async loading snippet, convert it into an identify object - if (Object.prototype.hasOwnProperty.call(identify_obj, '_q')) { + if (type(identify_obj) === 'object' && Object.prototype.hasOwnProperty.call(identify_obj, '_q')) { identify_obj = _convertProxyObjectToRealObject(new Identify(), identify_obj); } @@ -1196,7 +1196,7 @@ AmplitudeClient.prototype.groupIdentify = function (group_type, group_name, iden } // if identify input is a proxied object created by the async loading snippet, convert it into an identify object - if (Object.prototype.hasOwnProperty.call(identify_obj, '_q')) { + if (type(identify_obj) === 'object' && Object.prototype.hasOwnProperty.call(identify_obj, '_q')) { identify_obj = _convertProxyObjectToRealObject(new Identify(), identify_obj); } @@ -1524,7 +1524,7 @@ AmplitudeClient.prototype.logRevenueV2 = function logRevenueV2(revenue_obj) { } // if revenue input is a proxied object created by the async loading snippet, convert it into an revenue object - if (Object.prototype.hasOwnProperty.call(revenue_obj, '_q')) { + if (type(revenue_obj) === 'object' && Object.prototype.hasOwnProperty.call(revenue_obj, '_q')) { revenue_obj = _convertProxyObjectToRealObject(new Revenue(), revenue_obj); } diff --git a/src/utils.js b/src/utils.js index 91728052..59aeb0f2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -11,7 +11,7 @@ var logLevels = { let logLevel = logLevels.WARN; const setLogLevel = function setLogLevel(logLevelName) { - if (Object.prototype.hasOwnProperty.call(logLevels, logLevel)) { + if (Object.prototype.hasOwnProperty.call(logLevels, logLevelName)) { logLevel = logLevels[logLevelName]; } }; diff --git a/test/amplitude-client.js b/test/amplitude-client.js index fdc8df1d..570c18b9 100644 --- a/test/amplitude-client.js +++ b/test/amplitude-client.js @@ -1945,7 +1945,7 @@ describe('AmplitudeClient', function () { assert.equal(message, 'success'); }); - it.only('should run the callback even with a dropped unsent event', function () { + it('should run the callback even with a dropped unsent event', function () { amplitude.init(apiKey, null, { savedMaxCount: 1 }); var counter = 0; var value = null;