Skip to content

Commit

Permalink
Add feature flags to test
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal committed Nov 15, 2016
1 parent bfcadf1 commit 01f9671
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions client/app/scripts/charts/__tests__/node-layout-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ describe('NodesLayout', () => {
};

beforeEach(() => {
// clear feature flags
window.localStorage.clear();

options = {
nodeCache: makeMap(),
edgeCache: makeMap()
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions client/app/scripts/utils/feature-utils.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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}`;

/**
* 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
*/
Expand Down

0 comments on commit 01f9671

Please sign in to comment.