2018-03-07 23:36:05 +00:00
|
|
|
import { delay, SagaIterator } from 'redux-saga';
|
2018-06-11 22:43:39 +00:00
|
|
|
import { call, fork, put, take, select, apply } from 'redux-saga/effects';
|
2018-06-18 01:53:00 +00:00
|
|
|
import { cloneableGenerator, SagaIteratorClone } from 'redux-saga/utils';
|
|
|
|
import { shepherd } from 'mycrypto-shepherd';
|
|
|
|
|
|
|
|
import { translateRaw } from 'translations';
|
|
|
|
import { makeAutoNodeName } from 'libs/nodes';
|
|
|
|
import { Web3Wallet } from 'libs/wallet';
|
|
|
|
import { StaticNodeConfig, CustomNodeConfig } from 'types/node';
|
|
|
|
import configuredStore from 'features/store';
|
|
|
|
import * as notificationsActions from 'features/notifications/actions';
|
|
|
|
import { selectedNodeExpectedState } from './nodes/selected/reducer.spec';
|
|
|
|
import { staticNodesExpectedState } from './nodes/static/reducer.spec';
|
|
|
|
import { customNodesExpectedState, firstCustomNode } from './nodes/custom/reducer.spec';
|
|
|
|
import { setLatestBlock } from './meta/actions';
|
|
|
|
import { getOffline } from './meta/selectors';
|
|
|
|
import { CONFIG_NETWORKS, ChangeNetworkRequestedAction } from './networks/types';
|
|
|
|
import { getNodeConfig } from './nodes/selectors';
|
|
|
|
import { CONFIG_NODES_CUSTOM, RemoveCustomNodeAction } from './nodes/custom/types';
|
|
|
|
import { getCustomNodeFromId } from './nodes/custom/selectors';
|
|
|
|
import { CONFIG_NODES_SELECTED, ChangeNodeRequestedOneTimeAction } from './nodes/selected/types';
|
2018-03-01 04:31:33 +00:00
|
|
|
import {
|
2018-05-29 14:51:42 +00:00
|
|
|
changeNodeRequested,
|
2018-06-18 01:53:00 +00:00
|
|
|
changeNodeSucceeded,
|
2018-05-30 02:24:38 +00:00
|
|
|
changeNodeFailed,
|
2018-03-01 04:31:33 +00:00
|
|
|
changeNodeForce,
|
2018-05-29 14:51:42 +00:00
|
|
|
changeNodeRequestedOneTime
|
2018-06-18 01:53:00 +00:00
|
|
|
} from './nodes/selected/actions';
|
|
|
|
import { SELECTED_NODE_INITIAL_STATE } from './nodes/selected/reducer';
|
|
|
|
import { getNodeId, getPreviouslySelectedNode } from './nodes/selected/selectors';
|
|
|
|
import { isStaticNodeId } from './nodes/static/selectors';
|
|
|
|
import { getAllNodes, getStaticNodeFromId } from './selectors';
|
2017-11-30 04:07:16 +00:00
|
|
|
import {
|
2018-06-18 01:53:00 +00:00
|
|
|
unsetWeb3Node,
|
|
|
|
unsetWeb3NodeOnWalletEvent,
|
2018-04-12 23:17:46 +00:00
|
|
|
handleNewNetwork,
|
2018-06-18 01:53:00 +00:00
|
|
|
handleChangeNodeRequested,
|
|
|
|
handleChangeNodeRequestedOneTime,
|
|
|
|
handleNodeChangeForce,
|
|
|
|
handleChangeNetworkRequested,
|
|
|
|
handleRemoveCustomNode
|
|
|
|
} from './sagas';
|
2018-02-12 20:43:07 +00:00
|
|
|
|
2017-11-30 04:07:16 +00:00
|
|
|
// init module
|
|
|
|
configuredStore.getState();
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
describe('handleChangeNodeRequested*', () => {
|
2018-03-07 23:36:05 +00:00
|
|
|
let originalRandom: any;
|
2017-11-30 04:07:16 +00:00
|
|
|
|
|
|
|
// normal operation variables
|
2018-03-07 23:36:05 +00:00
|
|
|
const defaultNodeId: any = selectedNodeExpectedState.initialState.nodeId;
|
|
|
|
const defaultNodeConfig: any = (staticNodesExpectedState as any).initialState[defaultNodeId];
|
2018-02-12 20:43:07 +00:00
|
|
|
const newNodeId = Object.keys(staticNodesExpectedState.initialState).reduce(
|
|
|
|
(acc, cur) =>
|
2018-03-07 23:36:05 +00:00
|
|
|
(staticNodesExpectedState as any).initialState[cur].network !== defaultNodeConfig.network
|
|
|
|
? cur
|
|
|
|
: acc
|
2017-11-30 04:07:16 +00:00
|
|
|
);
|
2018-03-07 23:36:05 +00:00
|
|
|
const newNodeConfig: StaticNodeConfig = (staticNodesExpectedState as any).initialState[newNodeId];
|
2018-04-27 03:55:31 +00:00
|
|
|
const isOffline = false;
|
2018-05-29 14:51:42 +00:00
|
|
|
const changeNodeRequestedAction = changeNodeRequested(newNodeId);
|
2017-11-30 04:07:16 +00:00
|
|
|
const latestBlock = '0xa';
|
|
|
|
|
|
|
|
const data = {} as any;
|
2018-05-29 14:51:42 +00:00
|
|
|
data.gen = cloneableGenerator(handleChangeNodeRequested)(changeNodeRequestedAction);
|
2017-11-30 04:07:16 +00:00
|
|
|
|
2018-03-07 23:36:05 +00:00
|
|
|
function shouldBailOut(gen: SagaIterator, nextVal: any, errMsg: string) {
|
2018-06-18 01:53:00 +00:00
|
|
|
expect(gen.next(nextVal).value).toEqual(
|
|
|
|
put(notificationsActions.showNotification('danger', errMsg, 5000))
|
|
|
|
);
|
2018-05-30 02:24:38 +00:00
|
|
|
expect(gen.next().value).toEqual(put(changeNodeFailed()));
|
2018-01-09 20:13:14 +00:00
|
|
|
expect(gen.next().done).toEqual(true);
|
|
|
|
}
|
|
|
|
|
2017-11-30 04:07:16 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
originalRandom = Math.random;
|
|
|
|
Math.random = () => 0.001;
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(() => {
|
|
|
|
Math.random = originalRandom;
|
|
|
|
});
|
|
|
|
|
2018-02-12 20:43:07 +00:00
|
|
|
it('should select is static node', () => {
|
|
|
|
expect(data.gen.next().value).toEqual(select(isStaticNodeId, newNodeId));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should select nodeConfig', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
expect(data.gen.next(defaultNodeId).value).toEqual(select(getNodeConfig));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
2018-02-12 20:43:07 +00:00
|
|
|
it('should select getStaticNodeFromId', () => {
|
|
|
|
expect(data.gen.next(defaultNodeConfig).value).toEqual(select(getStaticNodeFromId, newNodeId));
|
2018-01-09 20:13:14 +00:00
|
|
|
});
|
|
|
|
|
2018-04-06 20:52:48 +00:00
|
|
|
it('should get the next network', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
expect(data.gen.next(newNodeConfig).value).toMatchSnapshot();
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
2018-04-27 03:55:31 +00:00
|
|
|
it('should select isOffline', () => {
|
|
|
|
expect(data.gen.next(true).value).toEqual(select(getOffline));
|
|
|
|
});
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
it('should show error if check times out', () => {
|
|
|
|
data.clone1 = data.gen.clone();
|
|
|
|
data.clone1.next(true);
|
|
|
|
expect(data.clone1.throw('err').value).toEqual(
|
2018-06-18 01:53:00 +00:00
|
|
|
put(notificationsActions.showNotification('danger', translateRaw('ERROR_32'), 5000))
|
2018-04-06 20:52:48 +00:00
|
|
|
);
|
2018-05-30 02:24:38 +00:00
|
|
|
expect(data.clone1.next().value).toEqual(put(changeNodeFailed()));
|
2018-05-29 14:51:42 +00:00
|
|
|
expect(data.clone1.next().done).toEqual(true);
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
2018-04-06 20:52:48 +00:00
|
|
|
|
|
|
|
it('should sucessfully switch to the manual node', () => {
|
2018-04-27 03:55:31 +00:00
|
|
|
expect(data.gen.next(isOffline).value).toEqual(
|
2018-04-06 20:52:48 +00:00
|
|
|
apply(shepherd, shepherd.manual, [newNodeId, false])
|
2018-02-12 20:43:07 +00:00
|
|
|
);
|
|
|
|
});
|
2018-04-06 20:52:48 +00:00
|
|
|
|
|
|
|
it('should get the current block', () => {
|
|
|
|
data.gen.next();
|
|
|
|
});
|
|
|
|
|
2017-11-30 04:07:16 +00:00
|
|
|
it('should put setLatestBlock', () => {
|
2018-04-06 20:52:48 +00:00
|
|
|
expect(data.gen.next(latestBlock).value).toEqual(put(setLatestBlock(latestBlock)));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should put changeNode', () => {
|
|
|
|
expect(data.gen.next().value).toEqual(
|
2018-05-29 14:51:42 +00:00
|
|
|
put(changeNodeSucceeded({ networkId: newNodeConfig.network, nodeId: newNodeId }))
|
2017-11-30 04:07:16 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2018-02-25 01:32:34 +00:00
|
|
|
it('should fork handleNewNetwork', () => {
|
|
|
|
expect(data.gen.next().value).toEqual(fork(handleNewNetwork));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should be done', () => {
|
|
|
|
expect(data.gen.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
// custom node variables
|
2018-02-12 20:43:07 +00:00
|
|
|
const customNodeConfigs = customNodesExpectedState.addFirstCustomNode;
|
2018-05-29 14:51:42 +00:00
|
|
|
const customNodeAction = changeNodeRequested(firstCustomNode.id);
|
|
|
|
data.customNode = handleChangeNodeRequested(customNodeAction);
|
2017-11-30 04:07:16 +00:00
|
|
|
|
|
|
|
// test custom node
|
|
|
|
it('should select getCustomNodeConfig and match race snapshot', () => {
|
|
|
|
data.customNode.next();
|
2018-02-12 20:43:07 +00:00
|
|
|
data.customNode.next(false);
|
|
|
|
expect(data.customNode.next(defaultNodeConfig).value).toEqual(
|
2018-05-29 14:51:42 +00:00
|
|
|
select(getCustomNodeFromId, firstCustomNode.id)
|
2018-02-12 20:43:07 +00:00
|
|
|
);
|
2018-04-06 20:52:48 +00:00
|
|
|
expect(data.customNode.next(customNodeConfigs.customNode1).value).toMatchSnapshot();
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
const customNodeIdNotFound = firstCustomNode.id + 'notFound';
|
|
|
|
const customNodeNotFoundAction = changeNodeRequested(customNodeIdNotFound);
|
|
|
|
data.customNodeNotFound = handleChangeNodeRequested(customNodeNotFoundAction);
|
2018-02-12 20:43:07 +00:00
|
|
|
|
2017-11-30 04:07:16 +00:00
|
|
|
// test custom node not found
|
2018-01-09 20:13:14 +00:00
|
|
|
it('should handle unknown / missing custom node', () => {
|
2017-11-30 04:07:16 +00:00
|
|
|
data.customNodeNotFound.next();
|
2018-02-12 20:43:07 +00:00
|
|
|
data.customNodeNotFound.next(false);
|
|
|
|
});
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
it('should select getCustomNodeFromId', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
expect(data.customNodeNotFound.next(defaultNodeConfig).value).toEqual(
|
|
|
|
select(getCustomNodeFromId, customNodeIdNotFound)
|
2017-11-30 04:07:16 +00:00
|
|
|
);
|
2018-02-12 20:43:07 +00:00
|
|
|
});
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
it('should show an error if was an unknown custom node', () => {
|
2018-01-09 20:13:14 +00:00
|
|
|
shouldBailOut(
|
|
|
|
data.customNodeNotFound,
|
2018-02-12 20:43:07 +00:00
|
|
|
null,
|
2018-01-09 20:13:14 +00:00
|
|
|
`Attempted to switch to unknown node '${customNodeNotFoundAction.payload}'`
|
2017-11-30 04:07:16 +00:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-05-29 14:51:42 +00:00
|
|
|
describe('handleChangeNodeRequestedOneTime', () => {
|
|
|
|
const saga = handleChangeNodeRequestedOneTime();
|
|
|
|
const action: ChangeNodeRequestedOneTimeAction = changeNodeRequestedOneTime('eth_auto');
|
2018-04-12 23:17:46 +00:00
|
|
|
it('should take a one time action based on the url containing a valid network to switch to', () => {
|
2018-06-18 01:53:00 +00:00
|
|
|
expect(saga.next().value).toEqual(take(CONFIG_NODES_SELECTED.CHANGE_REQUESTED_ONETIME));
|
2018-04-12 23:17:46 +00:00
|
|
|
});
|
|
|
|
it(`should delay for 10 ms to allow shepherdProvider async init to complete`, () => {
|
|
|
|
expect(saga.next(action).value).toEqual(call(delay, 100));
|
|
|
|
});
|
|
|
|
it('should dispatch the change node intent', () => {
|
2018-05-29 14:51:42 +00:00
|
|
|
expect(saga.next().value).toEqual(put(changeNodeRequested(action.payload)));
|
2018-04-12 23:17:46 +00:00
|
|
|
});
|
|
|
|
it('should be done', () => {
|
|
|
|
expect(saga.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-11-30 04:07:16 +00:00
|
|
|
describe('unsetWeb3Node*', () => {
|
2018-04-09 17:23:37 +00:00
|
|
|
const previousNodeId = 'eth_mycrypto';
|
2018-04-06 22:23:25 +00:00
|
|
|
const mockNodeId = 'web3';
|
2017-12-01 16:32:29 +00:00
|
|
|
const gen = unsetWeb3Node();
|
|
|
|
|
|
|
|
it('should select getNode', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
expect(gen.next().value).toEqual(select(getNodeId));
|
2017-12-01 16:32:29 +00:00
|
|
|
});
|
|
|
|
|
2018-02-12 20:43:07 +00:00
|
|
|
it('should select an alternative node to web3', () => {
|
2018-04-06 20:52:48 +00:00
|
|
|
// get a 'no visual difference' error here
|
2018-04-09 17:23:37 +00:00
|
|
|
expect(gen.next(mockNodeId).value).toEqual(select(getPreviouslySelectedNode));
|
2017-12-01 16:32:29 +00:00
|
|
|
});
|
|
|
|
|
2018-03-01 04:31:33 +00:00
|
|
|
it('should put changeNodeForce', () => {
|
2018-04-09 17:23:37 +00:00
|
|
|
expect(gen.next(previousNodeId).value).toEqual(put(changeNodeForce(previousNodeId)));
|
2017-12-01 16:32:29 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should be done', () => {
|
|
|
|
expect(gen.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return early if node type is not web3', () => {
|
|
|
|
const gen1 = unsetWeb3Node();
|
|
|
|
gen1.next();
|
|
|
|
gen1.next('notWeb3');
|
|
|
|
expect(gen1.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('unsetWeb3NodeOnWalletEvent*', () => {
|
2018-03-07 23:36:05 +00:00
|
|
|
const fakeAction: any = {};
|
2018-02-12 20:43:07 +00:00
|
|
|
const mockNodeId = 'web3';
|
2018-04-09 17:23:37 +00:00
|
|
|
const previousNodeId = 'eth_mycrypto';
|
2017-12-01 16:32:29 +00:00
|
|
|
const gen = unsetWeb3NodeOnWalletEvent(fakeAction);
|
2017-11-30 04:07:16 +00:00
|
|
|
|
|
|
|
it('should select getNode', () => {
|
2018-02-12 20:43:07 +00:00
|
|
|
expect(gen.next().value).toEqual(select(getNodeId));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
2018-02-12 20:43:07 +00:00
|
|
|
it('should select an alternative node to web3', () => {
|
2018-04-09 17:23:37 +00:00
|
|
|
expect(gen.next(mockNodeId).value).toEqual(select(getPreviouslySelectedNode));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
2018-03-01 04:31:33 +00:00
|
|
|
it('should put changeNodeForce', () => {
|
2018-04-09 17:23:37 +00:00
|
|
|
expect(gen.next(previousNodeId).value).toEqual(put(changeNodeForce(previousNodeId)));
|
2017-11-30 04:07:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should be done', () => {
|
|
|
|
expect(gen.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return early if node type is not web3', () => {
|
2018-03-07 23:36:05 +00:00
|
|
|
const gen1 = unsetWeb3NodeOnWalletEvent({ payload: false } as any);
|
2017-11-30 04:07:16 +00:00
|
|
|
gen1.next(); //getNode
|
|
|
|
gen1.next('notWeb3'); //getNodeConfig
|
|
|
|
expect(gen1.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return early if wallet type is web3', () => {
|
|
|
|
const mockAddress = '0x0';
|
|
|
|
const mockNetwork = 'ETH';
|
2017-12-01 16:32:29 +00:00
|
|
|
const mockWeb3Wallet = new Web3Wallet(mockAddress, mockNetwork);
|
2018-03-07 23:36:05 +00:00
|
|
|
const gen2 = unsetWeb3NodeOnWalletEvent({ payload: mockWeb3Wallet } as any);
|
2017-11-30 04:07:16 +00:00
|
|
|
gen2.next(); //getNode
|
|
|
|
gen2.next('web3'); //getNodeConfig
|
|
|
|
expect(gen2.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
2018-06-18 01:53:00 +00:00
|
|
|
|
|
|
|
describe('handleNodeChangeForce*', () => {
|
|
|
|
const payload: any = 'nodeId';
|
|
|
|
const action: any = { payload };
|
|
|
|
const gen = cloneableGenerator(handleNodeChangeForce)(action);
|
|
|
|
const nodeConfig: any = { network: 'network' };
|
|
|
|
|
|
|
|
it('should select isStaticNodeId', () => {
|
|
|
|
expect(gen.next().value).toEqual(select(isStaticNodeId, payload));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return if not static node', () => {
|
|
|
|
const clone = gen.clone();
|
|
|
|
expect(clone.next(false).done).toEqual(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should select getStaticNodeFromId', () => {
|
|
|
|
expect(gen.next(true).value).toEqual(select(getStaticNodeFromId, payload));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should force the node change', () => {
|
|
|
|
expect(gen.next(nodeConfig).value).toEqual(
|
|
|
|
put(
|
|
|
|
changeNodeSucceeded({
|
|
|
|
networkId: nodeConfig.network,
|
|
|
|
nodeId: payload
|
|
|
|
})
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should put a change node intent', () => {
|
|
|
|
expect(gen.next().value).toEqual(put(changeNodeRequested(payload)));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should be done', () => {
|
|
|
|
expect(gen.next().done).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('handleChangeNetworkRequested*', () => {
|
|
|
|
const action: ChangeNetworkRequestedAction = {
|
|
|
|
payload: 'ETH',
|
|
|
|
type: CONFIG_NETWORKS.CHANGE_NETWORK_REQUESTED
|
|
|
|
};
|
|
|
|
const nextNodeName = makeAutoNodeName(action.payload);
|
|
|
|
const customNode: CustomNodeConfig = {
|
|
|
|
id: 'id',
|
|
|
|
url: 'url',
|
|
|
|
name: 'Custom Node',
|
|
|
|
service: 'your custom node',
|
|
|
|
network: action.payload,
|
|
|
|
isCustom: true
|
|
|
|
};
|
|
|
|
const gen = cloneableGenerator(handleChangeNetworkRequested);
|
|
|
|
const staticCase = gen(action);
|
|
|
|
let customCase: SagaIteratorClone;
|
|
|
|
let failureCase: SagaIteratorClone;
|
|
|
|
|
|
|
|
it('should select isStaticNodeId', () => {
|
|
|
|
expect(staticCase.next().value).toEqual(select(isStaticNodeId, nextNodeName));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should put changeNodeRequested for auto node if static network', () => {
|
|
|
|
customCase = staticCase.clone();
|
|
|
|
expect(staticCase.next(true).value).toEqual(put(changeNodeRequested(nextNodeName)));
|
|
|
|
expect(staticCase.next().done).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should select getAllNodes if non-static network', () => {
|
|
|
|
expect(customCase.next(false).value).toEqual(select(getAllNodes));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should put changeNodeRequested on the first custom node if found', () => {
|
|
|
|
failureCase = customCase.clone();
|
|
|
|
expect(customCase.next([customNode]).value).toEqual(put(changeNodeRequested(customNode.id)));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should put showNotification if not a valid network', () => {
|
|
|
|
const value = failureCase.next([]).value as any;
|
|
|
|
expect(value.PUT.action.type).toBe('SHOW_NOTIFICATION');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('handleRemoveCustomNode*', () => {
|
|
|
|
const customNodeUrl = 'https://mycustomnode.com';
|
|
|
|
const action: RemoveCustomNodeAction = {
|
|
|
|
type: CONFIG_NODES_CUSTOM.REMOVE,
|
|
|
|
payload: customNodeUrl
|
|
|
|
};
|
|
|
|
const sameCase = cloneableGenerator(handleRemoveCustomNode)(action);
|
|
|
|
let diffCase: SagaIteratorClone;
|
|
|
|
|
|
|
|
it('Should select getNodeId', () => {
|
|
|
|
expect(sameCase.next().value).toEqual(select(getNodeId));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Should put changeNodeForce to default network if current node id === removed node id', () => {
|
|
|
|
diffCase = sameCase.clone();
|
|
|
|
expect(sameCase.next(customNodeUrl).value).toEqual(
|
|
|
|
put(changeNodeForce(SELECTED_NODE_INITIAL_STATE.nodeId))
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Should do nothing if current node id !== removed node id', () => {
|
|
|
|
expect(diffCase.next('Different').done).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|