diff --git a/spec/reducers/config/meta/meta.spec.ts b/spec/reducers/config/meta/meta.spec.ts index b77225a3..03126fb4 100644 --- a/spec/reducers/config/meta/meta.spec.ts +++ b/spec/reducers/config/meta/meta.spec.ts @@ -72,3 +72,5 @@ describe('meta reducer', () => { expectedState.settingLatestBlock )); }); + +export { actions as metaActions, expectedState as metaExpectedState }; diff --git a/spec/reducers/config/networks/customNetworks.spec.ts b/spec/reducers/config/networks/customNetworks.spec.ts index 6c855949..ce3f0f3f 100644 --- a/spec/reducers/config/networks/customNetworks.spec.ts +++ b/spec/reducers/config/networks/customNetworks.spec.ts @@ -58,3 +58,5 @@ describe('custom networks reducer', () => { customNetworks(expectedState.addSecondCustomNetwork, actions.removeFirstCustomNetwork) ).toEqual(expectedState.removeFirstCustomNetwork)); }); + +export { actions as customNetworksActions, expectedState as customNetworksExpectedState }; diff --git a/spec/reducers/config/networks/selectedNetwork.spec.ts b/spec/reducers/config/networks/selectedNetwork.spec.ts index 4215897a..1795bac1 100644 --- a/spec/reducers/config/networks/selectedNetwork.spec.ts +++ b/spec/reducers/config/networks/selectedNetwork.spec.ts @@ -14,3 +14,5 @@ describe('selected network reducer', () => { expectedState.nodeChange )); }); + +export { actions as selectedNetworkActions, expectedState as selectedNetworkExpectedState }; diff --git a/spec/reducers/config/networks/staticNetworks.spec.ts b/spec/reducers/config/networks/staticNetworks.spec.ts index c22f2c00..4ce6d276 100644 --- a/spec/reducers/config/networks/staticNetworks.spec.ts +++ b/spec/reducers/config/networks/staticNetworks.spec.ts @@ -146,3 +146,5 @@ describe('static networks reducer', () => { JSON.stringify(expectedState.initialState) )); }); + +export { expectedState as staticNetworksExpectedState }; diff --git a/spec/reducers/config/nodes/customNodes.spec.ts b/spec/reducers/config/nodes/customNodes.spec.ts index 9aaa8092..b18f7be1 100644 --- a/spec/reducers/config/nodes/customNodes.spec.ts +++ b/spec/reducers/config/nodes/customNodes.spec.ts @@ -2,7 +2,7 @@ import { addCustomNode, removeCustomNode } from 'actions/config'; import { CustomNodeConfig } from 'types/node'; import { customNodes } from 'reducers/config/nodes/customNodes'; -const firstCustomNodeId = 'customNode1'; +export const firstCustomNodeId = 'customNode1'; const firstCustomNode: CustomNodeConfig = { isCustom: true, id: firstCustomNodeId, @@ -20,7 +20,7 @@ const secondCustomNode: CustomNodeConfig = { id: secondCustomNodeId }; -const expectedStates = { +const expectedState = { initialState: {}, addFirstCustomNode: { [firstCustomNodeId]: firstCustomNode }, addSecondCustomNode: { @@ -41,15 +41,17 @@ describe('custom nodes reducer', () => { expect(customNodes(undefined, {} as any)).toEqual({})); it('should handle adding the first custom node', () => - expect(customNodes(expectedStates.initialState, actions.addFirstCustomNode)).toEqual( - expectedStates.addFirstCustomNode + expect(customNodes(expectedState.initialState, actions.addFirstCustomNode)).toEqual( + expectedState.addFirstCustomNode )); it('should handle adding a second custom node', () => - expect(customNodes(expectedStates.addFirstCustomNode, actions.addSecondCustomNode)).toEqual( - expectedStates.addSecondCustomNode + expect(customNodes(expectedState.addFirstCustomNode, actions.addSecondCustomNode)).toEqual( + expectedState.addSecondCustomNode )); it('should handle removing the first custom node', () => - expect(customNodes(expectedStates.addSecondCustomNode, actions.removeFirstCustomNode)).toEqual( - expectedStates.removeFirstCustomNode + expect(customNodes(expectedState.addSecondCustomNode, actions.removeFirstCustomNode)).toEqual( + expectedState.removeFirstCustomNode )); }); + +export { actions as customNodesActions, expectedState as customNodesExpectedState }; diff --git a/spec/reducers/config/nodes/selectedNode.spec.ts b/spec/reducers/config/nodes/selectedNode.spec.ts index e5e9f86f..395fc5e2 100644 --- a/spec/reducers/config/nodes/selectedNode.spec.ts +++ b/spec/reducers/config/nodes/selectedNode.spec.ts @@ -1,7 +1,7 @@ import { changeNodeIntent, changeNode } from 'actions/config'; import { State, selectedNode } from 'reducers/config/nodes/selectedNode'; -export const expectedState: { [key: string]: State } = { +export const expectedState = { initialState: { nodeId: 'eth_mew', pending: false }, nodeChange: { nodeId: 'nodeToChangeTo', pending: false }, nodeChangeIntent: { nodeId: 'eth_mew', pending: true } @@ -20,7 +20,9 @@ describe('selected node reducer', () => { expect(selectedNode(undefined, actions.changeNode)).toEqual(expectedState.nodeChange)); 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 )); }); + +export { actions as selectedNodeActions, expectedState as selectedNodeExpectedState }; diff --git a/spec/reducers/config/nodes/staticNodes.spec.ts b/spec/reducers/config/nodes/staticNodes.spec.ts index 61a66f62..3bc81413 100644 --- a/spec/reducers/config/nodes/staticNodes.spec.ts +++ b/spec/reducers/config/nodes/staticNodes.spec.ts @@ -5,7 +5,7 @@ import { Web3NodeConfig } from 'types/node'; import { networkIdToName } from 'libs/values'; import { Web3Service } from 'libs/nodes/web3'; -const expectedInitialState = JSON.stringify({ +const expectedInitialState = { eth_mew: { network: 'ETH', isCustom: false, @@ -90,7 +90,7 @@ const expectedInitialState = JSON.stringify({ lib: new RPCNode('https://node.expanse.tech/'), estimateGas: true } -}); +}; const web3Id = 'web3'; const web3NetworkId = 1; @@ -103,7 +103,7 @@ const web3Node: Web3NodeConfig = { hidden: true }; -const expectedStates = { +const expectedState = { initialState: expectedInitialState, setWeb3: { ...INITIAL_STATE, [web3Id]: web3Node }, unsetWeb3: { ...INITIAL_STATE } @@ -117,12 +117,16 @@ const actions = { describe('static nodes reducer', () => { it('should return the inital 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', () => - 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', () => - expect(staticNodes(expectedStates.setWeb3, actions.web3UnsetNode)).toEqual( - expectedStates.unsetWeb3 + expect(staticNodes(expectedState.setWeb3, actions.web3UnsetNode)).toEqual( + expectedState.unsetWeb3 )); }); + +export { actions as staticNodesActions, expectedState as staticNodesExpectedState };