1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/ui/pages/first-time-flow/end-of-flow/end-of-flow.test.js
Thomas Huang 06450a4056
Various test files converting to @testing-library/react. (#15504)
* Convert End of Flow test to tlr.

* Convert Select Action test to tlr

* Convert Metametrics opt in test to tlr
2022-08-09 10:37:29 -05:00

37 lines
1.0 KiB
JavaScript

import React from 'react';
import sinon from 'sinon';
import { fireEvent, screen } from '@testing-library/react';
import { tick } from '../../../../test/lib/tick';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
import EndOfFlowScreen from './end-of-flow.container';
describe('End of Flow Screen', () => {
const props = {
history: {
push: sinon.stub(),
},
setCompletedOnboarding: sinon.stub().resolves(),
};
beforeEach(() => {
renderWithProvider(<EndOfFlowScreen.WrappedComponent {...props} />);
});
it('should render', () => {
const endOfFlow = screen.queryByTestId('end-of-flow');
expect(endOfFlow).toBeInTheDocument();
});
it('should navigate to the default route on click', async () => {
const endOfFlowButton = screen.getByTestId('EOF-complete-button');
fireEvent.click(endOfFlowButton);
await tick();
expect(
props.history.push.calledOnceWithExactly(DEFAULT_ROUTE),
).toStrictEqual(true);
});
});