mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
Should not expose legacy fields to whole system
This commit is contained in:
parent
4f8851ef2e
commit
84ea153f2a
@ -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 };
|
||||
|
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user