Skip to content

Commit

Permalink
mock withRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro-Melnyshyn committed Nov 25, 2024
1 parent 42025bc commit 4a53805
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/QuickMarcEditor/QuickMarcEditor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import React from 'react';
import faker from 'faker';
import { useLocation } from 'react-router';
import { createMemoryHistory } from 'history';


Check failure on line 7 in src/QuickMarcEditor/QuickMarcEditor.test.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

More than 1 blank line not allowed

Check failure on line 7 in src/QuickMarcEditor/QuickMarcEditor.test.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

More than 1 blank line not allowed
import {
render,
Expand All @@ -25,9 +27,12 @@ import Harness from '../../test/jest/helpers/harness';
import buildStripes from '../../test/jest/__mock__/stripesCore.mock';
import { bibLeader } from '../../test/jest/fixtures/leaders';

const mockHistory = createMemoryHistory();

jest.mock('react-router', () => ({
...jest.requireActual('react-router'),
useLocation: jest.fn(),
withRouter: Component => props => <Component history={mockHistory} {...props} />,
}));

jest.mock('../queries', () => ({
Expand Down

0 comments on commit 4a53805

Please sign in to comment.