From 1caf2ddc536bccb7a0637cc6d2e66b76d57557a7 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 6 May 2016 11:11:32 +0200 Subject: [PATCH] seems like knex 0.11 is more restrict about not using undefined --- lib/eventStore.js | 2 +- lib/featureDb.js | 6 +++--- lib/strategyDb.js | 2 +- test/specHelper.js | 3 ++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/eventStore.js b/lib/eventStore.js index f8e24072c0..67802c3cfa 100644 --- a/lib/eventStore.js +++ b/lib/eventStore.js @@ -10,7 +10,7 @@ util.inherits(EventStore, EventEmitter); EventStore.prototype.create = function (event) { var that = this; return eventDb.store(event).then(function() { - that.emit(event.type, event); + return that.emit(event.type, event); }); }; diff --git a/lib/featureDb.js b/lib/featureDb.js index 21b6d55bb4..28f51bd173 100644 --- a/lib/featureDb.js +++ b/lib/featureDb.js @@ -65,11 +65,11 @@ function rowToFeature(row) { function eventDataToRow(data) { return { name: data.name, - description: data.description, + description: data.description || '', enabled: data.enabled ? 1 : 0, archived: data.archived ? 1 :0, - strategy_name: data.strategy, // eslint-disable-line - parameters: data.parameters + strategy_name: data.strategy || 'default', // eslint-disable-line + parameters: data.parameters || {} }; } diff --git a/lib/strategyDb.js b/lib/strategyDb.js index daa7241a82..2972bdfae1 100644 --- a/lib/strategyDb.js +++ b/lib/strategyDb.js @@ -50,7 +50,7 @@ function eventDataToRow(data) { return { name: data.name, description: data.description, - parameters_template: data.parametersTemplate // eslint-disable-line + parameters_template: data.parametersTemplate || {} // eslint-disable-line }; } diff --git a/test/specHelper.js b/test/specHelper.js index a7f23cf8fc..3f8f7552ca 100644 --- a/test/specHelper.js +++ b/test/specHelper.js @@ -15,7 +15,8 @@ function createStrategies() { return Promise.map([ { name: "default", - description: "Default on or off Strategy." + description: "Default on or off Strategy.", + parametersTemplate: {} }, { name: "usersWithEmail",