mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +00:00
a61dc268dc
* create config reducer tests * create generateWallet reducer tests * create wallet reducer tests * create swap reducer tests; use empty string as destination amount when origin amount is an empty string instead of 0 * add additional swap reducer tests * refactor swap; additional tests * create separate dir for swap reducer
30 lines
838 B
JavaScript
30 lines
838 B
JavaScript
import { wallet, INITIAL_STATE } from 'reducers/wallet';
|
|
import * as walletActions from 'actions/wallet';
|
|
import Big from 'bignumber.js';
|
|
|
|
describe('wallet reducer', () => {
|
|
it('should return the initial state', () => {
|
|
expect(wallet(undefined, {})).toEqual(INITIAL_STATE);
|
|
});
|
|
|
|
it('should handle WALLET_SET', () => {
|
|
const walletInstance = { wallet: true };
|
|
expect(wallet(undefined, walletActions.setWallet(walletInstance))).toEqual({
|
|
...INITIAL_STATE,
|
|
inst: walletInstance,
|
|
balance: new Big(0),
|
|
tokens: {}
|
|
});
|
|
});
|
|
|
|
it('should handle WALLET_SET_TOKEN_BALANCES', () => {
|
|
const tokenBalances = { OMG: new Big(20) };
|
|
expect(
|
|
wallet(undefined, walletActions.setTokenBalances(tokenBalances))
|
|
).toEqual({
|
|
...INITIAL_STATE,
|
|
tokens: tokenBalances
|
|
});
|
|
});
|
|
});
|