From beed39f13ebc9ed06460ecc61460e538f69cc19a Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Tue, 15 Nov 2016 11:50:16 +0100 Subject: [PATCH] Add feature flags to test --- client/app/scripts/charts/__tests__/node-layout-test.js | 6 ++++++ client/app/scripts/utils/feature-utils.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/app/scripts/charts/__tests__/node-layout-test.js b/client/app/scripts/charts/__tests__/node-layout-test.js index 9668705cd..72f0467c5 100644 --- a/client/app/scripts/charts/__tests__/node-layout-test.js +++ b/client/app/scripts/charts/__tests__/node-layout-test.js @@ -133,6 +133,9 @@ describe('NodesLayout', () => { }; beforeEach(() => { + // clear feature flags + window.localStorage.clear(); + options = { nodeCache: makeMap(), edgeCache: makeMap() @@ -416,6 +419,9 @@ describe('NodesLayout', () => { }); it('adds a new node to existing layout in a line', () => { + // feature flag + window.localStorage.setItem('scope-experimental:layout-dance', true); + let result = NodesLayout.doLayout( nodeSets.rank4.nodes, nodeSets.rank4.edges, diff --git a/client/app/scripts/utils/feature-utils.js b/client/app/scripts/utils/feature-utils.js index 91c2fccfe..0e6a9681c 100644 --- a/client/app/scripts/utils/feature-utils.js +++ b/client/app/scripts/utils/feature-utils.js @@ -1,7 +1,7 @@ import { storageGet, storageSet } from './storage-utils'; // prefix for all feature flags -const STORAGE_KEY_PREFIX = 'scope-experimental-'; +const STORAGE_KEY_PREFIX = 'scope-experimental:'; const getKey = key => `${STORAGE_KEY_PREFIX}${key}`; @@ -9,7 +9,7 @@ const getKey = key => `${STORAGE_KEY_PREFIX}${key}`; * Returns true if `feature` is enabled * * Features can be enabled either via calling `setFeature()` or by setting - * `localStorage.scope-experimental-featureName = true` in the console. + * `localStorage.scope-experimental:featureName = true` in the console. * @param {String} feature Feature name, ideally one word or hyphenated * @return {Boolean} True if feature is enabled */