MyCrypto/spec/reducers/wallet.spec.ts
James Prado 0d5d0cea9a Wallet Loading States & Spinner Update (#334)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Replace '???' with Spinner & update spinner

* Add loading states for wallet balances

* Update wallet test

* Remove excess data passed to wallet balance reducer & Fix wallet balance types

* Merge 'develop' into 'loading-indicator'

* Add 'light' prop to Spinner

* Only show spinners when fetching data

* Remove format diff

* Apply naming conventions

* Remove network name when offline
2017-11-14 21:44:55 -06:00

33 lines
927 B
TypeScript

import { wallet, INITIAL_STATE } from 'reducers/wallet';
import * as walletActions from 'actions/wallet';
import { TokenValue } from 'libs/units';
describe('wallet reducer', () => {
it('should handle WALLET_SET', () => {
const doSomething = new Promise<string>(resolve => {
setTimeout(() => resolve('Success'), 1000);
});
const walletInstance = {
getAddressString: () => doSomething,
signRawTransaction: () => doSomething,
signMessage: () => doSomething
};
expect(wallet(undefined, walletActions.setWallet(walletInstance))).toEqual({
...INITIAL_STATE,
inst: walletInstance
});
});
it('should handle WALLET_SET_TOKEN_BALANCES', () => {
const tokenBalances = { OMG: TokenValue('20') };
expect(
wallet(undefined, walletActions.setTokenBalances(tokenBalances))
).toEqual({
...INITIAL_STATE,
tokens: tokenBalances
});
});
});