mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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 };
 | 
					module.exports = { addOldFields, toNewFormat };
 | 
				
			||||||
 | 
				
			|||||||
@ -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);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user