MyCrypto/spec/reducers/config/nodes/staticNodes.spec.ts
HenryNguyen5 04eaa08d6c Shepherd MVP Integration (#1413)
* initial mvp

* First functioning pass

* Add token balance shim

* Add working web3 implementation

* Fix tests

* Fix tsc errors

* Implement token batch splitting

* Undo logger change

* Fix linting errors

* Revert makeconfig change

* Add typing to token proxy + use string interpolation

* Remove useless parameter

* Remove logging

* Use type coercion to fix proxied methods

* Update shepherd

* Update to typescript 2.8.1

* Fix merged typings

* Address PR comments

* replace myc-shepherd with mycrypto-shepherd
2018-04-06 15:52:48 -05:00

40 lines
1.2 KiB
TypeScript

import { configuredStore } from 'store';
import { web3SetNode, web3UnsetNode } from 'actions/config';
import { staticNodes, INITIAL_STATE } from 'reducers/config/nodes/staticNodes';
import { Web3Service } from 'libs/nodes/web3';
import { StaticNodeConfig } from 'types/node';
configuredStore.getState();
const web3Id = 'web3';
const web3Node: StaticNodeConfig = {
isCustom: false,
network: 'ETH',
service: Web3Service,
lib: jest.fn() as any,
estimateGas: false,
hidden: true
};
const expectedState = {
initialState: staticNodes(undefined, {} as any),
setWeb3: { ...INITIAL_STATE, [web3Id]: web3Node },
unsetWeb3: { ...INITIAL_STATE }
};
const actions = {
web3SetNode: web3SetNode({ id: web3Id, config: web3Node }),
web3UnsetNode: web3UnsetNode()
};
describe('static nodes reducer', () => {
it('should handle setting the web3 node', () =>
expect(staticNodes(INITIAL_STATE, actions.web3SetNode)).toEqual(expectedState.setWeb3));
it('should handle unsetting the web3 node', () =>
expect(staticNodes(expectedState.setWeb3, actions.web3UnsetNode)).toEqual(
expectedState.unsetWeb3
));
});
export { actions as staticNodesActions, expectedState as staticNodesExpectedState };