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 { DEFAULT_ROUTE } from '../../../../helpers/constants/routes';
|
|
|
|
import EndOfFlowScreen from '..';
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('End of Flow Screen', function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
let wrapper;
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
const props = {
|
|
|
|
history: {
|
|
|
|
push: sinon.spy(),
|
|
|
|
},
|
2020-11-10 22:27:08 +01:00
|
|
|
setCompletedOnboarding: 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(<EndOfFlowScreen.WrappedComponent {...props} />);
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('renders', function () {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.strictEqual(wrapper.length, 1);
|
|
|
|
});
|
2020-01-30 20:34:45 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should navigate to the default route on click', function (done) {
|
2021-02-04 19:15:23 +01:00
|
|
|
const endOfFlowButton = wrapper.find(
|
|
|
|
'.btn-primary.first-time-flow__button',
|
|
|
|
);
|
|
|
|
endOfFlowButton.simulate('click');
|
2020-01-30 20:34:45 +01:00
|
|
|
|
|
|
|
setImmediate(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert(props.history.push.calledOnceWithExactly(DEFAULT_ROUTE));
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|