import { TokenValue } from 'libs/units';
import configuredStore from 'features/store';
import * as types from './types';
import * as actions from './actions';
import * as reducer from './reducer';
configuredStore.getState();
describe('deterministicWallets reducer', () => {
const tokenValues: types.ITokenValues = {
OMG: {
value: TokenValue('0'),
decimal: 16
}
};
const wallet: types.DeterministicWalletData = {
index: 0,
address: 'address',
tokenValues
it('should handle DW_SET_WALLETS', () => {
const wallets = [wallet];
expect(
reducer.deterministicWalletsReducer(undefined, actions.setDeterministicWallets(wallets))
).toEqual({
...reducer.INITIAL_STATE,
wallets
});
it('should handle DW_SET_DESIRED_TOKEN', () => {
const desiredToken = 'OMG';
reducer.deterministicWalletsReducer(undefined, actions.setDesiredToken(desiredToken))
desiredToken
it('should handle DW_UPDATE_WALLET', () => {
const wallet1 = {
...wallet,
address: 'wallet1'
const wallet2 = {
address: 'wallet2'
const wallets = [wallet1, wallet2];
const state = reducer.deterministicWalletsReducer(
undefined,
actions.setDeterministicWallets(wallets)
);
const wallet2Update = {
index: 100,
address: 'wallet2',
value: TokenValue('100')
reducer.deterministicWalletsReducer(state, actions.updateDeterministicWallet(wallet2Update))
wallets: [wallet1, wallet2Update]