Mock return object of useLocation() hook

useLocation hook from react-router returns object location, I need to mock the object in my test, how to do it?

This is the code in my component which I need to test:

const { search } = useLocation();

By best guess solution looks like:

jest.mock('react-router-dom', () => ({
  useLocation: jest.fn().mockReturnValue({
    location: '/test',