1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00

Should not expose legacy fields to whole system

This commit is contained in:
ivaosthu 2016-11-22 22:21:10 +01:00
parent 4f8851ef2e
commit 84ea153f2a
2 changed files with 13 additions and 2 deletions

View File

@ -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 }; module.exports = { addOldFields, toNewFormat };

View File

@ -49,6 +49,8 @@ test('should not transform if it already is the new format', t => {
const feature = { const feature = {
name: 'test', name: 'test',
enabled: 0, enabled: 0,
description: 'test',
createdAt: new Date(),
strategies: [{ strategies: [{
name: 'default', name: 'default',
parameters: { parameters: {
@ -59,5 +61,5 @@ test('should not transform if it already is the new format', t => {
const mappedFeature = mapper.toNewFormat(feature); const mappedFeature = mapper.toNewFormat(feature);
t.true(mappedFeature === feature); t.deepEqual(mappedFeature, feature);
}); });