diff --git a/lib/data-helper/legacy-feature-mapper.js b/lib/data-helper/legacy-feature-mapper.js index e67b7aeba5..d5895b79f6 100644 --- a/lib/data-helper/legacy-feature-mapper.js +++ b/lib/data-helper/legacy-feature-mapper.js @@ -30,8 +30,17 @@ function toNewFormat (feature) { }, ], }; + } else { + return { + name: feature.name, + description: feature.description, + enabled: feature.enabled, + strategies: feature.strategies, + createdAt: feature.createdAt + } + } - return feature; + } module.exports = { addOldFields, toNewFormat }; diff --git a/lib/data-helper/legacy-feature-mapper.test.js b/lib/data-helper/legacy-feature-mapper.test.js index 61cf455e98..dab20184a7 100644 --- a/lib/data-helper/legacy-feature-mapper.test.js +++ b/lib/data-helper/legacy-feature-mapper.test.js @@ -49,6 +49,8 @@ test('should not transform if it already is the new format', t => { const feature = { name: 'test', enabled: 0, + description: 'test', + createdAt: new Date(), strategies: [{ name: 'default', parameters: { @@ -59,5 +61,5 @@ test('should not transform if it already is the new format', t => { const mappedFeature = mapper.toNewFormat(feature); - t.true(mappedFeature === feature); + t.deepEqual(mappedFeature, feature); });