This is a valid way to mock modules in React codebases jest.mock('react', () => ({ ...jest.requireActual('react'), useRef: jest.fn(), })); This e...
Learn the difference between toEqual and toMatchObject with simple examples