mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 03:26:14 +00:00
Refactor configNetworksStatic
This commit is contained in:
parent
05aee772d0
commit
46386a7e1d
@ -1,3 +1,5 @@
|
||||
export * from './types';
|
||||
export * from './reducer';
|
||||
export * from './selectors';
|
||||
import * as configNetworksStaticTypes from './types';
|
||||
import * as configNetworksStaticReducer from './reducer';
|
||||
import * as configNetworksStaticSelectors from './selectors';
|
||||
|
||||
export { configNetworksStaticTypes, configNetworksStaticReducer, configNetworksStaticSelectors };
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { staticNetworksReducer, STATIC_NETWORKS_INITIAL_STATE } from './reducer';
|
||||
import * as reducer from './reducer';
|
||||
|
||||
describe('Testing contained data', () => {
|
||||
it(`contain unique chainIds`, () => {
|
||||
const networkValues = Object.values(STATIC_NETWORKS_INITIAL_STATE);
|
||||
const networkValues = Object.values(reducer.STATIC_NETWORKS_INITIAL_STATE);
|
||||
const chainIds = networkValues.map(a => a.chainId);
|
||||
const chainIdsSet = new Set(chainIds);
|
||||
expect(Array.from(chainIdsSet).length).toEqual(chainIds.length);
|
||||
@ -11,7 +11,7 @@ describe('Testing contained data', () => {
|
||||
|
||||
describe('static networks reducer', () => {
|
||||
it('should return the initial state', () =>
|
||||
expect(JSON.stringify(staticNetworksReducer(undefined, {} as any))).toEqual(
|
||||
JSON.stringify(STATIC_NETWORKS_INITIAL_STATE)
|
||||
expect(JSON.stringify(reducer.staticNetworksReducer(undefined, {} as any))).toEqual(
|
||||
JSON.stringify(reducer.STATIC_NETWORKS_INITIAL_STATE)
|
||||
));
|
||||
});
|
||||
|
@ -28,8 +28,8 @@ import {
|
||||
ESN_DEFAULT
|
||||
} from 'config/dpaths';
|
||||
import { makeExplorer } from 'utils/helpers';
|
||||
import { StaticNetworksState } from './types';
|
||||
import { TAB } from 'components/Header/components/constants';
|
||||
import * as types from './types';
|
||||
|
||||
const testnetDefaultGasPrice = {
|
||||
min: 0.1,
|
||||
@ -37,7 +37,7 @@ const testnetDefaultGasPrice = {
|
||||
initial: 4
|
||||
};
|
||||
|
||||
export const STATIC_NETWORKS_INITIAL_STATE: StaticNetworksState = {
|
||||
export const STATIC_NETWORKS_INITIAL_STATE: types.ConfigStaticNetworksState = {
|
||||
ETH: {
|
||||
id: 'ETH',
|
||||
name: 'Ethereum',
|
||||
@ -498,7 +498,7 @@ export const STATIC_NETWORKS_INITIAL_STATE: StaticNetworksState = {
|
||||
};
|
||||
|
||||
export function staticNetworksReducer(
|
||||
state: StaticNetworksState = STATIC_NETWORKS_INITIAL_STATE,
|
||||
state: types.ConfigStaticNetworksState = STATIC_NETWORKS_INITIAL_STATE,
|
||||
action: any
|
||||
) {
|
||||
switch (action.type) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { StaticNetworkIds, StaticNetworkConfig, DPathFormats } from 'types/network';
|
||||
|
||||
export type StaticNetworksState = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
export type ConfigStaticNetworksState = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
|
||||
export type PathType = keyof DPathFormats;
|
||||
|
Loading…
x
Reference in New Issue
Block a user