mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-12 03:54:13 +00:00
c31490c8b4
* set return type in resetWallet action creator * update config reducer test * update generateWallet reducer test * update swap reducer test * update wallet reducer test * create customTokens reducer test * create deterministicWallets reducer test * create ens reducer test * create notifications reducer test * add crypto compare success/fail actions * add rates reducer test * remove unnecessary comments * remove more comments * remove duplicate import * update wallet reducer test to use BN * update dWallet reducer test to use BN * update wallet reducer tests * update rates reducer tests
82 lines
1.7 KiB
TypeScript
82 lines
1.7 KiB
TypeScript
import {
|
|
deterministicWallets,
|
|
INITIAL_STATE
|
|
} from 'reducers/deterministicWallets';
|
|
import * as dWalletActions from 'actions/deterministicWallets';
|
|
import { TokenValue } from 'libs/units';
|
|
|
|
describe('deterministicWallets reducer', () => {
|
|
const tokenValues: dWalletActions.ITokenValues = {
|
|
OMG: {
|
|
value: TokenValue('0'),
|
|
decimal: 16
|
|
}
|
|
};
|
|
|
|
const wallet: dWalletActions.DeterministicWalletData = {
|
|
index: 0,
|
|
address: 'address',
|
|
value: TokenValue('0'),
|
|
tokenValues
|
|
};
|
|
|
|
it('should handle DW_SET_WALLETS', () => {
|
|
const wallets = [wallet];
|
|
expect(
|
|
deterministicWallets(
|
|
undefined,
|
|
dWalletActions.setDeterministicWallets(wallets)
|
|
)
|
|
).toEqual({
|
|
...INITIAL_STATE,
|
|
wallets
|
|
});
|
|
});
|
|
|
|
it('should handle DW_SET_DESIRED_TOKEN', () => {
|
|
const desiredToken = 'OMG';
|
|
expect(
|
|
deterministicWallets(
|
|
undefined,
|
|
dWalletActions.setDesiredToken(desiredToken)
|
|
)
|
|
).toEqual({
|
|
...INITIAL_STATE,
|
|
desiredToken
|
|
});
|
|
});
|
|
|
|
it('should handle DW_UPDATE_WALLET', () => {
|
|
const wallet1 = {
|
|
...wallet,
|
|
address: 'wallet1'
|
|
};
|
|
const wallet2 = {
|
|
...wallet,
|
|
address: 'wallet2'
|
|
};
|
|
const wallets = [wallet1, wallet2];
|
|
const state = deterministicWallets(
|
|
undefined,
|
|
dWalletActions.setDeterministicWallets(wallets)
|
|
);
|
|
|
|
const wallet2Update = {
|
|
...wallet,
|
|
index: 100,
|
|
address: 'wallet2',
|
|
value: TokenValue('100')
|
|
};
|
|
|
|
expect(
|
|
deterministicWallets(
|
|
state,
|
|
dWalletActions.updateDeterministicWallet(wallet2Update)
|
|
)
|
|
).toEqual({
|
|
...INITIAL_STATE,
|
|
wallets: [wallet1, wallet2Update]
|
|
});
|
|
});
|
|
});
|