2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import reduceMetamask from '../../../../../ui/app/ducks/metamask/metamask';
|
|
|
|
import * as actionConstants from '../../../../../ui/app/store/actionConstants';
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('MetaMask Reducers', function () {
|
|
|
|
it('init state', function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
const initState = reduceMetamask(undefined, {});
|
|
|
|
assert(initState);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('locks MetaMask', function () {
|
2018-10-31 15:07:25 +01:00
|
|
|
const unlockMetaMaskState = {
|
2020-02-06 17:38:14 +01:00
|
|
|
isUnlocked: true,
|
|
|
|
selectedAddress: 'test address',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
const lockMetaMask = reduceMetamask(unlockMetaMaskState, {
|
2020-04-09 02:35:37 +02:00
|
|
|
type: actionConstants.LOCK_METAMASK,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(lockMetaMask.isUnlocked, false);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets rpc target', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_RPC_TARGET,
|
|
|
|
value: 'https://custom.rpc',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.provider.rpcUrl, 'https://custom.rpc');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets provider type', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_PROVIDER_TYPE,
|
|
|
|
value: 'provider type',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.provider.type, 'provider type');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('shows account detail', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SHOW_ACCOUNT_DETAIL,
|
|
|
|
value: 'test address',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.isUnlocked, true);
|
|
|
|
assert.equal(state.isInitialized, true);
|
|
|
|
assert.equal(state.selectedAddress, 'test address');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets account label', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_ACCOUNT_LABEL,
|
|
|
|
value: {
|
|
|
|
account: 'test account',
|
|
|
|
label: 'test label',
|
|
|
|
},
|
2018-10-10 10:12:46 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
assert.deepEqual(state.identities, {
|
|
|
|
'test account': { name: 'test label' },
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets current fiat', function () {
|
2018-10-10 10:12:46 +02:00
|
|
|
const value = {
|
|
|
|
currentCurrency: 'yen',
|
|
|
|
conversionRate: 3.14,
|
|
|
|
conversionDate: new Date(2018, 9),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_CURRENT_FIAT,
|
|
|
|
value,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.currentCurrency, value.currentCurrency);
|
|
|
|
assert.equal(state.conversionRate, value.conversionRate);
|
|
|
|
assert.equal(state.conversionDate, value.conversionDate);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates tokens', function () {
|
2018-10-10 10:12:46 +02:00
|
|
|
const newTokens = {
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_TOKENS,
|
|
|
|
newTokens,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(state.tokens, newTokens);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates send gas limit', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_GAS_LIMIT,
|
|
|
|
value: '0xGasLimit',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.gasLimit, '0xGasLimit');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates send gas price', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_GAS_PRICE,
|
|
|
|
value: '0xGasPrice',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.gasPrice, '0xGasPrice');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('toggles account menu ', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.TOGGLE_ACCOUNT_MENU,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.isAccountMenuOpen, true);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates gas total', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_GAS_TOTAL,
|
|
|
|
value: '0xGasTotal',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.gasTotal, '0xGasTotal');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates send token balance', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_TOKEN_BALANCE,
|
|
|
|
value: '0xTokenBalance',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.tokenBalance, '0xTokenBalance');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates data', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_HEX_DATA,
|
|
|
|
value: '0xData',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.data, '0xData');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates send to', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_TO,
|
|
|
|
value: {
|
|
|
|
to: '0xAddress',
|
|
|
|
nickname: 'nickname',
|
|
|
|
},
|
2018-10-10 10:12:46 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.to, '0xAddress');
|
|
|
|
assert.equal(state.send.toNickname, 'nickname');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('update send amount', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_AMOUNT,
|
|
|
|
value: '0xAmount',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.amount, '0xAmount');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates max mode', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_MAX_MODE,
|
|
|
|
value: true,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.send.maxModeOn, true);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('update send', function () {
|
2018-10-10 10:12:46 +02:00
|
|
|
const value = {
|
|
|
|
gasLimit: '0xGasLimit',
|
|
|
|
gasPrice: '0xGasPrice',
|
|
|
|
gasTotal: '0xGasTotal',
|
|
|
|
tokenBalance: '0xBalance',
|
|
|
|
from: '0xAddress',
|
|
|
|
to: '0xAddress',
|
|
|
|
toNickname: '',
|
|
|
|
maxModeOn: false,
|
|
|
|
amount: '0xAmount',
|
|
|
|
memo: '0xMemo',
|
|
|
|
errors: {},
|
|
|
|
editingTransactionId: 22,
|
2019-07-31 21:56:44 +02:00
|
|
|
ensResolution: null,
|
|
|
|
ensResolutionError: '',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const sendState = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND,
|
|
|
|
value,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(sendState.send, value);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clears send', function () {
|
2018-10-31 15:07:25 +01:00
|
|
|
const initStateSend = {
|
2020-11-03 00:41:28 +01:00
|
|
|
send: {
|
2020-08-19 18:27:05 +02:00
|
|
|
gasLimit: null,
|
2018-10-31 15:07:25 +01:00
|
|
|
gasPrice: null,
|
|
|
|
gasTotal: null,
|
|
|
|
tokenBalance: null,
|
|
|
|
from: '',
|
|
|
|
to: '',
|
|
|
|
amount: '0x0',
|
|
|
|
memo: '',
|
|
|
|
errors: {},
|
|
|
|
maxModeOn: false,
|
|
|
|
editingTransactionId: null,
|
2020-08-19 18:27:05 +02:00
|
|
|
toNickname: '',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-31 15:07:25 +01:00
|
|
|
|
|
|
|
const sendState = {
|
|
|
|
send: {
|
|
|
|
gasLimit: '0xGasLimit',
|
|
|
|
gasPrice: '0xGasPrice',
|
|
|
|
gasTotal: '0xGasTotal',
|
|
|
|
tokenBalance: '0xBalance',
|
|
|
|
from: '0xAddress',
|
|
|
|
to: '0xAddress',
|
|
|
|
toNickname: '',
|
|
|
|
maxModeOn: false,
|
|
|
|
amount: '0xAmount',
|
|
|
|
memo: '0xMemo',
|
|
|
|
errors: {},
|
|
|
|
editingTransactionId: 22,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-31 15:07:25 +01:00
|
|
|
|
2018-10-10 10:12:46 +02:00
|
|
|
const state = reduceMetamask(sendState, {
|
2020-04-09 02:35:37 +02:00
|
|
|
type: actionConstants.CLEAR_SEND,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-10-31 15:07:25 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(state.send, initStateSend.send);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates value of tx by id', function () {
|
2018-10-10 10:12:46 +02:00
|
|
|
const oldState = {
|
2020-03-06 22:34:56 +01:00
|
|
|
currentNetworkTxList: [
|
2020-02-06 17:38:14 +01:00
|
|
|
{
|
|
|
|
id: 1,
|
|
|
|
txParams: 'foo',
|
|
|
|
},
|
|
|
|
],
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
|
|
|
|
const state = reduceMetamask(oldState, {
|
2020-04-09 02:35:37 +02:00
|
|
|
type: actionConstants.UPDATE_TRANSACTION_PARAMS,
|
2018-10-10 10:12:46 +02:00
|
|
|
id: 1,
|
|
|
|
value: 'bar',
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.currentNetworkTxList[0].txParams, 'bar');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets blockies', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_USE_BLOCKIE,
|
|
|
|
value: true,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.useBlockie, true);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('updates an arbitrary feature flag', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_FEATURE_FLAGS,
|
|
|
|
value: {
|
|
|
|
foo: true,
|
|
|
|
},
|
2018-10-10 10:12:46 +02:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.featureFlags.foo, true);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('close welcome screen', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.CLOSE_WELCOME_SCREEN,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.welcomeScreenSeen, true);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets current locale', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_CURRENT_LOCALE,
|
|
|
|
value: { locale: 'ge' },
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.equal(state.currentLocale, 'ge');
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('sets pending tokens ', function () {
|
2018-10-10 10:12:46 +02:00
|
|
|
const payload = {
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const pendingTokensState = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.SET_PENDING_TOKENS,
|
|
|
|
payload,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(pendingTokensState.pendingTokens, payload);
|
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clears pending tokens', function () {
|
2018-10-31 15:07:25 +01:00
|
|
|
const payload = {
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-31 15:07:25 +01:00
|
|
|
|
|
|
|
const pendingTokensState = {
|
|
|
|
pendingTokens: payload,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-10-31 15:07:25 +01:00
|
|
|
|
2018-10-10 10:12:46 +02:00
|
|
|
const state = reduceMetamask(pendingTokensState, {
|
2020-04-09 02:35:37 +02:00
|
|
|
type: actionConstants.CLEAR_PENDING_TOKENS,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-10-10 10:12:46 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(state.pendingTokens, {});
|
|
|
|
});
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('update ensResolution', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_ENS_RESOLUTION,
|
|
|
|
payload: '0x1337',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(state.send.ensResolution, '0x1337');
|
|
|
|
assert.deepEqual(state.send.ensResolutionError, '');
|
|
|
|
});
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('update ensResolutionError', function () {
|
2020-11-03 00:41:28 +01:00
|
|
|
const state = reduceMetamask(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
type: actionConstants.UPDATE_SEND_ENS_RESOLUTION_ERROR,
|
|
|
|
payload: 'ens name not found',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(state.send.ensResolutionError, 'ens name not found');
|
|
|
|
assert.deepEqual(state.send.ensResolution, null);
|
|
|
|
});
|
|
|
|
});
|