You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
988 B
39 lines
988 B
4 years ago
|
import React from 'react';
|
||
|
import sinon from 'sinon';
|
||
4 years ago
|
import { tick } from '../../../../test/lib/tick';
|
||
|
import { mountWithRouter } from '../../../../test/lib/render-helpers';
|
||
4 years ago
|
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
|
||
|
import EndOfFlowScreen from './end-of-flow.container';
|
||
5 years ago
|
|
||
4 years ago
|
describe('End of Flow Screen', () => {
|
||
4 years ago
|
let wrapper;
|
||
5 years ago
|
|
||
|
const props = {
|
||
|
history: {
|
||
4 years ago
|
push: sinon.stub(),
|
||
5 years ago
|
},
|
||
4 years ago
|
setCompletedOnboarding: sinon.stub().resolves(),
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
beforeEach(() => {
|
||
4 years ago
|
wrapper = mountWithRouter(<EndOfFlowScreen.WrappedComponent {...props} />);
|
||
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('renders', () => {
|
||
|
expect(wrapper).toHaveLength(1);
|
||
4 years ago
|
});
|
||
5 years ago
|
|
||
4 years ago
|
it('should navigate to the default route on click', async () => {
|
||
4 years ago
|
const endOfFlowButton = wrapper.find(
|
||
|
'.btn-primary.first-time-flow__button',
|
||
|
);
|
||
|
endOfFlowButton.simulate('click');
|
||
5 years ago
|
|
||
4 years ago
|
await tick();
|
||
|
|
||
|
expect(
|
||
|
props.history.push.calledOnceWithExactly(DEFAULT_ROUTE),
|
||
|
).toStrictEqual(true);
|
||
4 years ago
|
});
|
||
|
});
|