2021-02-04 19:15:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
2021-04-28 21:53:59 +02:00
|
|
|
import { mountWithRouter } from '../../../../test/lib/render-helpers';
|
2021-03-16 22:00:08 +01:00
|
|
|
import SelectAction from './select-action.container';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('Selection Action', () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
let wrapper;
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
const props = {
|
|
|
|
isInitialized: false,
|
|
|
|
setFirstTimeFlowType: sinon.spy(),
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
beforeEach(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
wrapper = mountWithRouter(<SelectAction.WrappedComponent {...props} />);
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
afterEach(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
props.setFirstTimeFlowType.resetHistory();
|
|
|
|
props.history.push.resetHistory();
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('clicks import wallet to route to import FTF', () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const importWalletButton = wrapper
|
|
|
|
.find('.btn-primary.first-time-flow__button')
|
2021-02-04 19:15:23 +01:00
|
|
|
.at(0);
|
|
|
|
importWalletButton.simulate('click');
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(props.setFirstTimeFlowType.calledOnce).toStrictEqual(true);
|
|
|
|
expect(props.setFirstTimeFlowType.getCall(0).args[0]).toStrictEqual(
|
|
|
|
'import',
|
|
|
|
);
|
|
|
|
expect(props.history.push.calledOnce).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
it('clicks create wallet to route to create FTF', () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
const createWalletButton = wrapper
|
|
|
|
.find('.btn-primary.first-time-flow__button')
|
2021-02-04 19:15:23 +01:00
|
|
|
.at(1);
|
|
|
|
createWalletButton.simulate('click');
|
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(props.setFirstTimeFlowType.calledOnce).toStrictEqual(true);
|
|
|
|
expect(props.setFirstTimeFlowType.getCall(0).args[0]).toStrictEqual(
|
|
|
|
'create',
|
|
|
|
);
|
|
|
|
expect(props.history.push.calledOnce).toStrictEqual(true);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|