diff --git a/src/core.js b/src/core.js index 75221a4..c297502 100644 --- a/src/core.js +++ b/src/core.js @@ -272,7 +272,7 @@ export function timing( trackerNames ) { if (typeof ga === 'function') { - if (!category || !variable || !value || typeof value !== 'number') { + if (!category || !variable || typeof value !== 'number') { warn( 'args.category, args.variable ' + 'AND args.value are required in timing() ' + diff --git a/test/functionality/timing.test.js b/test/functionality/timing.test.js index af4f573..7be6e15 100644 --- a/test/functionality/timing.test.js +++ b/test/functionality/timing.test.js @@ -79,6 +79,20 @@ describe('timing()', () => { ); }); + it('should not warn if value arg is 0, a falsy number', () => { + ReactGA.initialize('foo'); + ReactGA.timing({ + category: 'Test', + variable: 'Timing test', + value: 0 + }); + expect(spies.warn).not.toHaveBeenCalledWith( + '[react-ga]', + 'args.category, args.variable AND args.value are required in timing() ' + + 'AND args.value has to be a number' + ); + }); + it('should warn if value arg is not a number', () => { ReactGA.initialize('foo'); ReactGA.timing({