2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import freeze from 'deep-freeze-strict';
|
|
|
|
import reducers from '../../../ui/app/ducks';
|
|
|
|
import * as actionConstants from '../../../ui/app/store/actionConstants';
|
|
|
|
import { NETWORK_TYPE_RPC } from '../../../shared/constants/network';
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
describe('config view actions', function () {
|
2019-12-03 15:52:01 +01:00
|
|
|
const initialState = {
|
2016-04-14 00:28:44 +02:00
|
|
|
metamask: {
|
2020-10-06 19:57:02 +02:00
|
|
|
rpcUrl: 'foo',
|
2017-05-04 23:35:10 +02:00
|
|
|
frequentRpcList: [],
|
2016-04-14 00:28:44 +02:00
|
|
|
},
|
|
|
|
appState: {
|
|
|
|
currentView: {
|
|
|
|
name: 'accounts',
|
2017-05-04 23:35:10 +02:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
freeze(initialState);
|
2016-04-14 00:28:44 +02:00
|
|
|
|
2017-05-04 23:35:10 +02:00
|
|
|
describe('SET_RPC_TARGET', function () {
|
2020-10-06 19:57:02 +02:00
|
|
|
it('sets the state.metamask.rpcUrl property of the state to the action.value', function () {
|
2016-04-14 00:28:44 +02:00
|
|
|
const action = {
|
2020-04-09 02:35:37 +02:00
|
|
|
type: actionConstants.SET_RPC_TARGET,
|
2017-03-07 19:37:01 +01:00
|
|
|
value: 'foo',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-03-07 19:37:01 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const result = reducers(initialState, action);
|
|
|
|
assert.equal(result.metamask.provider.type, NETWORK_TYPE_RPC);
|
|
|
|
assert.equal(result.metamask.provider.rpcUrl, 'foo');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|