I'm using useIntl hook in my component. In my test I mock useIntl in file react-intl.js in src/mocks directory. Also in this file, I mock defineMessages, that are used in many other components.
The part of mock with defineMessages in src/mocks/react-intl.js looks like
export const defineMessages = jest.fn(() => ({
defineMessages: jest.fn((...args) => JSON.stringify(args))
}));
The mock of useIntl looks the same, it works.
The problem is when I start the tests, I get undefined in places where I use defineMessages. Where is the error?