fix: fix unit tests of routes

This commit is contained in:
mashal-m
2022-10-25 12:32:18 +05:00
parent a27c24b2f7
commit 3b551ab87f
8 changed files with 16 additions and 15 deletions

View File

@@ -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');
});
});

View File

@@ -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');
});
});

View File

@@ -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');
});
});

View File

@@ -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');
});
});

View File

@@ -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 () => {

View File

@@ -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);
});

View File

@@ -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 () => {

View File

@@ -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');
});
});