2021-02-04 19:15:23 +01:00
|
|
|
import assert from 'assert';
|
|
|
|
import React from 'react';
|
|
|
|
import sinon from 'sinon';
|
|
|
|
import { mountWithRouter } from '../../../../../../test/lib/render-helpers';
|
|
|
|
import SelectAction from '..';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('Selection Action', function () {
|
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
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
beforeEach(function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
wrapper = mountWithRouter(<SelectAction.WrappedComponent {...props} />);
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
afterEach(function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
props.setFirstTimeFlowType.resetHistory();
|
|
|
|
props.history.push.resetHistory();
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks import wallet to route to import FTF', function () {
|
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-02-04 19:15:23 +01:00
|
|
|
assert(props.setFirstTimeFlowType.calledOnce);
|
|
|
|
assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'import');
|
|
|
|
assert(props.history.push.calledOnce);
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('clicks create wallet to route to create FTF ', function () {
|
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');
|
|
|
|
|
|
|
|
assert(props.setFirstTimeFlowType.calledOnce);
|
|
|
|
assert.strictEqual(props.setFirstTimeFlowType.getCall(0).args[0], 'create');
|
|
|
|
assert(props.history.push.calledOnce);
|
|
|
|
});
|
|
|
|
});
|