fix: fix unit tests of routes
This commit is contained in:
@@ -82,6 +82,6 @@ describe('GetNameIdPanel', () => {
|
||||
const button = await screen.findByTestId('next-button');
|
||||
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/summary');
|
||||
expect(history.location.pathname).toEqual('summary');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('IdContextPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-id-photo');
|
||||
expect(history.location.pathname).toEqual('take-id-photo');
|
||||
});
|
||||
|
||||
it('routes to TakeIdPhotoPanel if reachedSummary is true', async () => {
|
||||
@@ -59,6 +59,6 @@ describe('IdContextPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-id-photo');
|
||||
expect(history.location.pathname).toEqual('take-id-photo');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('PortraitPhotoContextPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-portrait-photo');
|
||||
expect(history.location.pathname).toEqual('take-portrait-photo');
|
||||
});
|
||||
|
||||
it('routes to TakePortraitPhotoPanel if reachedSummary is true', async () => {
|
||||
@@ -56,6 +56,6 @@ describe('PortraitPhotoContextPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-portrait-photo');
|
||||
expect(history.location.pathname).toEqual('take-portrait-photo');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('RequestCameraAccessPanel', () => {
|
||||
expect(text).toHaveTextContent(/Looks like your camera is working and ready./);
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/portrait-photo-context');
|
||||
expect(history.location.pathname).toEqual('portrait-photo-context');
|
||||
});
|
||||
|
||||
it('renders correctly with media access denied', async () => {
|
||||
@@ -215,6 +215,6 @@ describe('RequestCameraAccessPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/portrait-photo-context');
|
||||
expect(history.location.pathname).toEqual('portrait-photo-context');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('ReviewRequirementsPanel', () => {
|
||||
await getPanel();
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/request-camera-access');
|
||||
expect(history.location.pathname).toEqual('request-camera-access');
|
||||
});
|
||||
|
||||
it('displays an alert if the user\'s account information is managed by a third party', async () => {
|
||||
|
||||
@@ -22,7 +22,7 @@ dataService.submitIdVerification = jest.fn().mockReturnValue({ success: true });
|
||||
const IntlSummaryPanel = injectIntl(SummaryPanel);
|
||||
|
||||
const history = createMemoryHistory();
|
||||
|
||||
console.warn(history.location)
|
||||
describe('SummaryPanel', () => {
|
||||
const defaultProps = {
|
||||
intl: {},
|
||||
@@ -61,7 +61,7 @@ describe('SummaryPanel', () => {
|
||||
await getPanel();
|
||||
const button = await screen.findByTestId('portrait-retake');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-portrait-photo');
|
||||
expect(history.location.pathname).toEqual('take-portrait-photo');
|
||||
expect(history.location.state.fromSummary).toEqual(true);
|
||||
});
|
||||
|
||||
@@ -69,7 +69,8 @@ describe('SummaryPanel', () => {
|
||||
await getPanel();
|
||||
const button = await screen.findByTestId('id-retake');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/take-id-photo');
|
||||
console.warn(history.location)
|
||||
expect(history.location.pathname).toEqual('take-id-photo');
|
||||
expect(history.location.state.fromSummary).toEqual(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ describe('TakeIdPhotoPanel', () => {
|
||||
const button = await screen.findByTestId('next-button');
|
||||
expect(button).toBeVisible();
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/get-name-id');
|
||||
expect(history.location.pathname).toEqual('get-name-id');
|
||||
});
|
||||
|
||||
it('routes back to SummaryPanel if that was the source', async () => {
|
||||
@@ -80,7 +80,7 @@ describe('TakeIdPhotoPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/summary');
|
||||
expect(history.location.pathname).toEqual('summary');
|
||||
});
|
||||
|
||||
it('shows correct text if user should use upload', async () => {
|
||||
|
||||
@@ -65,7 +65,7 @@ describe('TakePortraitPhotoPanel', () => {
|
||||
const button = await screen.findByTestId('next-button');
|
||||
expect(button).toBeVisible();
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/id-context');
|
||||
expect(history.location.pathname).toEqual('id-context');
|
||||
});
|
||||
|
||||
it('routes back to SummaryPanel if that was the source', async () => {
|
||||
@@ -83,6 +83,6 @@ describe('TakePortraitPhotoPanel', () => {
|
||||
)));
|
||||
const button = await screen.findByTestId('next-button');
|
||||
fireEvent.click(button);
|
||||
expect(history.location.pathname).toEqual('/summary');
|
||||
expect(history.location.pathname).toEqual('summary');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user