From c0be8ae684ed02b212ed4ad77bf6e18abae8dc46 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 20 Aug 2019 11:26:05 -0700 Subject: [PATCH] Treat eventFlushInterval 0 as invalid --- .../lib/utils/event_processor_config_validator/index.js | 2 +- .../lib/utils/event_processor_config_validator/index.tests.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.js b/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.js index 2152bc684..b0fc63816 100644 --- a/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.js +++ b/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.js @@ -31,7 +31,7 @@ function validateEventBatchSize(eventBatchSize) { * @returns boolean */ function validateEventFlushInterval(eventFlushInterval) { - return fns.isFinite(eventFlushInterval) && eventFlushInterval >= 0; + return fns.isFinite(eventFlushInterval) && eventFlushInterval > 0; } module.exports = { diff --git a/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.tests.js b/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.tests.js index eed00aa03..a6c9e9ad6 100644 --- a/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.tests.js +++ b/packages/optimizely-sdk/lib/utils/event_processor_config_validator/index.tests.js @@ -38,6 +38,10 @@ describe('utils/event_processor_config_validator', function() { assert.isFalse(eventProcessorConfigValidator.validateEventFlushInterval(-1000)); }); + it('returns false for 0', function() { + assert.isFalse(eventProcessorConfigValidator.validateEventFlushInterval(0)); + }); + it('returns true for a positive integer', function() { assert.isTrue(eventProcessorConfigValidator.validateEventFlushInterval(30000)); });