Export needed variables
This commit is contained in:
parent
dccd976043
commit
d0c0dd541b
|
@ -72,3 +72,5 @@ describe('meta reducer', () => {
|
||||||
expectedState.settingLatestBlock
|
expectedState.settingLatestBlock
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as metaActions, expectedState as metaExpectedState };
|
||||||
|
|
|
@ -58,3 +58,5 @@ describe('custom networks reducer', () => {
|
||||||
customNetworks(expectedState.addSecondCustomNetwork, actions.removeFirstCustomNetwork)
|
customNetworks(expectedState.addSecondCustomNetwork, actions.removeFirstCustomNetwork)
|
||||||
).toEqual(expectedState.removeFirstCustomNetwork));
|
).toEqual(expectedState.removeFirstCustomNetwork));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as customNetworksActions, expectedState as customNetworksExpectedState };
|
||||||
|
|
|
@ -14,3 +14,5 @@ describe('selected network reducer', () => {
|
||||||
expectedState.nodeChange
|
expectedState.nodeChange
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as selectedNetworkActions, expectedState as selectedNetworkExpectedState };
|
||||||
|
|
|
@ -146,3 +146,5 @@ describe('static networks reducer', () => {
|
||||||
JSON.stringify(expectedState.initialState)
|
JSON.stringify(expectedState.initialState)
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { expectedState as staticNetworksExpectedState };
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { addCustomNode, removeCustomNode } from 'actions/config';
|
||||||
import { CustomNodeConfig } from 'types/node';
|
import { CustomNodeConfig } from 'types/node';
|
||||||
import { customNodes } from 'reducers/config/nodes/customNodes';
|
import { customNodes } from 'reducers/config/nodes/customNodes';
|
||||||
|
|
||||||
const firstCustomNodeId = 'customNode1';
|
export const firstCustomNodeId = 'customNode1';
|
||||||
const firstCustomNode: CustomNodeConfig = {
|
const firstCustomNode: CustomNodeConfig = {
|
||||||
isCustom: true,
|
isCustom: true,
|
||||||
id: firstCustomNodeId,
|
id: firstCustomNodeId,
|
||||||
|
@ -20,7 +20,7 @@ const secondCustomNode: CustomNodeConfig = {
|
||||||
id: secondCustomNodeId
|
id: secondCustomNodeId
|
||||||
};
|
};
|
||||||
|
|
||||||
const expectedStates = {
|
const expectedState = {
|
||||||
initialState: {},
|
initialState: {},
|
||||||
addFirstCustomNode: { [firstCustomNodeId]: firstCustomNode },
|
addFirstCustomNode: { [firstCustomNodeId]: firstCustomNode },
|
||||||
addSecondCustomNode: {
|
addSecondCustomNode: {
|
||||||
|
@ -41,15 +41,17 @@ describe('custom nodes reducer', () => {
|
||||||
expect(customNodes(undefined, {} as any)).toEqual({}));
|
expect(customNodes(undefined, {} as any)).toEqual({}));
|
||||||
|
|
||||||
it('should handle adding the first custom node', () =>
|
it('should handle adding the first custom node', () =>
|
||||||
expect(customNodes(expectedStates.initialState, actions.addFirstCustomNode)).toEqual(
|
expect(customNodes(expectedState.initialState, actions.addFirstCustomNode)).toEqual(
|
||||||
expectedStates.addFirstCustomNode
|
expectedState.addFirstCustomNode
|
||||||
));
|
));
|
||||||
it('should handle adding a second custom node', () =>
|
it('should handle adding a second custom node', () =>
|
||||||
expect(customNodes(expectedStates.addFirstCustomNode, actions.addSecondCustomNode)).toEqual(
|
expect(customNodes(expectedState.addFirstCustomNode, actions.addSecondCustomNode)).toEqual(
|
||||||
expectedStates.addSecondCustomNode
|
expectedState.addSecondCustomNode
|
||||||
));
|
));
|
||||||
it('should handle removing the first custom node', () =>
|
it('should handle removing the first custom node', () =>
|
||||||
expect(customNodes(expectedStates.addSecondCustomNode, actions.removeFirstCustomNode)).toEqual(
|
expect(customNodes(expectedState.addSecondCustomNode, actions.removeFirstCustomNode)).toEqual(
|
||||||
expectedStates.removeFirstCustomNode
|
expectedState.removeFirstCustomNode
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as customNodesActions, expectedState as customNodesExpectedState };
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { changeNodeIntent, changeNode } from 'actions/config';
|
import { changeNodeIntent, changeNode } from 'actions/config';
|
||||||
import { State, selectedNode } from 'reducers/config/nodes/selectedNode';
|
import { State, selectedNode } from 'reducers/config/nodes/selectedNode';
|
||||||
|
|
||||||
export const expectedState: { [key: string]: State } = {
|
export const expectedState = {
|
||||||
initialState: { nodeId: 'eth_mew', pending: false },
|
initialState: { nodeId: 'eth_mew', pending: false },
|
||||||
nodeChange: { nodeId: 'nodeToChangeTo', pending: false },
|
nodeChange: { nodeId: 'nodeToChangeTo', pending: false },
|
||||||
nodeChangeIntent: { nodeId: 'eth_mew', pending: true }
|
nodeChangeIntent: { nodeId: 'eth_mew', pending: true }
|
||||||
|
@ -20,7 +20,9 @@ describe('selected node reducer', () => {
|
||||||
expect(selectedNode(undefined, actions.changeNode)).toEqual(expectedState.nodeChange));
|
expect(selectedNode(undefined, actions.changeNode)).toEqual(expectedState.nodeChange));
|
||||||
|
|
||||||
it('should handle the intent to change a node', () =>
|
it('should handle the intent to change a node', () =>
|
||||||
expect(selectedNode(expectedState.initialState, actions.changeNodeIntent)).toEqual(
|
expect(selectedNode(expectedState.initialState as State, actions.changeNodeIntent)).toEqual(
|
||||||
expectedState.nodeChangeIntent
|
expectedState.nodeChangeIntent
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as selectedNodeActions, expectedState as selectedNodeExpectedState };
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Web3NodeConfig } from 'types/node';
|
||||||
import { networkIdToName } from 'libs/values';
|
import { networkIdToName } from 'libs/values';
|
||||||
import { Web3Service } from 'libs/nodes/web3';
|
import { Web3Service } from 'libs/nodes/web3';
|
||||||
|
|
||||||
const expectedInitialState = JSON.stringify({
|
const expectedInitialState = {
|
||||||
eth_mew: {
|
eth_mew: {
|
||||||
network: 'ETH',
|
network: 'ETH',
|
||||||
isCustom: false,
|
isCustom: false,
|
||||||
|
@ -90,7 +90,7 @@ const expectedInitialState = JSON.stringify({
|
||||||
lib: new RPCNode('https://node.expanse.tech/'),
|
lib: new RPCNode('https://node.expanse.tech/'),
|
||||||
estimateGas: true
|
estimateGas: true
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
const web3Id = 'web3';
|
const web3Id = 'web3';
|
||||||
const web3NetworkId = 1;
|
const web3NetworkId = 1;
|
||||||
|
@ -103,7 +103,7 @@ const web3Node: Web3NodeConfig = {
|
||||||
hidden: true
|
hidden: true
|
||||||
};
|
};
|
||||||
|
|
||||||
const expectedStates = {
|
const expectedState = {
|
||||||
initialState: expectedInitialState,
|
initialState: expectedInitialState,
|
||||||
setWeb3: { ...INITIAL_STATE, [web3Id]: web3Node },
|
setWeb3: { ...INITIAL_STATE, [web3Id]: web3Node },
|
||||||
unsetWeb3: { ...INITIAL_STATE }
|
unsetWeb3: { ...INITIAL_STATE }
|
||||||
|
@ -117,12 +117,16 @@ const actions = {
|
||||||
describe('static nodes reducer', () => {
|
describe('static nodes reducer', () => {
|
||||||
it('should return the inital state', () =>
|
it('should return the inital state', () =>
|
||||||
// turn the JSON into a string because we're storing function in the state
|
// turn the JSON into a string because we're storing function in the state
|
||||||
expect(JSON.stringify(staticNodes(undefined, {} as any))).toEqual(expectedStates.initialState));
|
expect(JSON.stringify(staticNodes(undefined, {} as any))).toEqual(
|
||||||
|
JSON.stringify(expectedState.initialState)
|
||||||
|
));
|
||||||
it('should handle setting the web3 node', () =>
|
it('should handle setting the web3 node', () =>
|
||||||
expect(staticNodes(INITIAL_STATE, actions.web3SetNode)).toEqual(expectedStates.setWeb3));
|
expect(staticNodes(INITIAL_STATE, actions.web3SetNode)).toEqual(expectedState.setWeb3));
|
||||||
|
|
||||||
it('should handle unsetting the web3 node', () =>
|
it('should handle unsetting the web3 node', () =>
|
||||||
expect(staticNodes(expectedStates.setWeb3, actions.web3UnsetNode)).toEqual(
|
expect(staticNodes(expectedState.setWeb3, actions.web3UnsetNode)).toEqual(
|
||||||
expectedStates.unsetWeb3
|
expectedState.unsetWeb3
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export { actions as staticNodesActions, expectedState as staticNodesExpectedState };
|
||||||
|
|
Loading…
Reference in New Issue