2017-08-24 08:53:59 +00:00
|
|
|
import { generateWallet, INITIAL_STATE } from 'reducers/generateWallet';
|
|
|
|
import * as generateWalletActions from 'actions/generateWallet';
|
2017-11-17 21:12:27 +00:00
|
|
|
import Wallet from 'ethereumjs-wallet';
|
2017-08-24 08:53:59 +00:00
|
|
|
|
|
|
|
describe('generateWallet reducer', () => {
|
2017-11-17 21:12:27 +00:00
|
|
|
it('should handle GENERATE_WALLET_GENERATE_WALLET', () => {
|
|
|
|
const { wallet, password, activeStep } = generateWallet(
|
|
|
|
undefined,
|
|
|
|
generateWalletActions.generateNewWallet('password')
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wallet).toBeInstanceOf(Wallet);
|
|
|
|
expect(password).toEqual('password');
|
|
|
|
expect(activeStep).toEqual('download');
|
|
|
|
});
|
|
|
|
|
2017-08-24 08:53:59 +00:00
|
|
|
it('should handle GENERATE_WALLET_CONTINUE_TO_PAPER', () => {
|
|
|
|
expect(
|
|
|
|
generateWallet(undefined, generateWalletActions.continueToPaper())
|
|
|
|
).toEqual({
|
|
|
|
...INITIAL_STATE,
|
|
|
|
activeStep: 'paper'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should handle GENERATE_WALLET_RESET', () => {
|
|
|
|
expect(
|
|
|
|
generateWallet(undefined, generateWalletActions.resetGenerateWallet())
|
|
|
|
).toEqual({
|
|
|
|
...INITIAL_STATE
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|