From 1de0d0a737b24f17f53ff23fe407788f196111c0 Mon Sep 17 00:00:00 2001 From: Ivar Date: Sat, 2 Jul 2016 17:05:14 +0200 Subject: [PATCH] Added some unit-test #102 --- .../unit/helper/legacy-feature-mapper.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/unleash-api/test/unit/helper/legacy-feature-mapper.test.js b/packages/unleash-api/test/unit/helper/legacy-feature-mapper.test.js index ad0daf8c87..11e91a1fff 100644 --- a/packages/unleash-api/test/unit/helper/legacy-feature-mapper.test.js +++ b/packages/unleash-api/test/unit/helper/legacy-feature-mapper.test.js @@ -45,4 +45,21 @@ describe('legacy-feature-mapper', () => { assert(mappedFeature.strategy === undefined); assert(mappedFeature.parameters === undefined); }); + + it('should not transform if it already is the new format', () => { + const feature = { + name: 'test', + enabled: 0, + strategies: [{ + name: 'default', + parameters: { + val: 'bar', + }, + }], + }; + + const mappedFeature = mapper.toNewFormat(feature); + + assert.equal(mappedFeature, feature); + }); });