Skip to content

Commit

Permalink
Simplify default network detection
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Mar 13, 2018
1 parent 8f4c5f2 commit e74b13f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/register/register.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Register', () => {
it('should call activePeerSet with network and passphrase', () => {
wrapper.find('MultiStep').props().finalCallback(passphrase);
expect(prop.activePeerSet).to.have.been.calledWith(match({
network: networks.testnet,
network: networks.mainnet,
passphrase,
}));
});
Expand Down
2 changes: 0 additions & 2 deletions src/constants/env.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const env = {
production: PRODUCTION,
development: (!PRODUCTION && !TEST),
defaultNetwork: 'mainnet',
test: TEST,
testNetwork: 'testnet',
};

export default env;
6 changes: 1 addition & 5 deletions src/constants/networks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import env from './env';

const networks = {
mainnet: { // network name translation t('Mainnet');
name: 'Mainnet',
Expand All @@ -22,7 +20,5 @@ const networks = {
},
};

let preferredNetwork = (window.localStorage && window.localStorage.getItem('defaultNetwork')) || /* istanbul ignore next */ env.defaultNetwork;
preferredNetwork = env.test ? env.testNetwork : /* istanbul ignore next */ preferredNetwork;
networks.default = networks[preferredNetwork];
networks.default = networks[window.localStorage && window.localStorage.getItem('defaultNetwork')] || networks.mainnet;
module.exports = networks;

0 comments on commit e74b13f

Please sign in to comment.