Skip to content

Commit

Permalink
Added the ability to change configuration properties programmatically (
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto authored Jan 16, 2017
1 parent 357e2e7 commit 61f4876
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/client/utils/ConfigUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ var ConfigUtils = {
},
getConfigProp: function(prop) {
return defaultConfig[prop];
},
setConfigProp: function(prop, value) {
defaultConfig[prop] = value;
},
removeConfigProp: function(prop) {
delete defaultConfig[prop];
}
};

Expand Down
12 changes: 12 additions & 0 deletions web/client/utils/__tests__/ConfigUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,16 @@ describe('ConfigUtils', () => {
}
})).toBe('http://remote.cors');
});

it('config prop', () => {
ConfigUtils.setConfigProp('testProperty', 'testValue');
expect(ConfigUtils.getConfigProp('testProperty')).toBe('testValue');
});

it('remove config prop', () => {
ConfigUtils.setConfigProp('testProperty', 'testValue');
expect(ConfigUtils.getConfigProp('testProperty')).toBe('testValue');
ConfigUtils.removeConfigProp('testProperty');
expect(ConfigUtils.getConfigProp('testProperty')).toNotExist();
});
});

0 comments on commit 61f4876

Please sign in to comment.