useAPIErrorHandler: Stop testing react-intl internals

This commit is contained in:
Gustav Hansen 2023-03-15 15:26:59 +01:00
parent b53f260ecf
commit 7f11c8bbdf

View File

@ -4,6 +4,7 @@ import { formatAxiosError } from '..';
describe('formatAxiosError', () => { describe('formatAxiosError', () => {
test('serializes AxiosError', () => { test('serializes AxiosError', () => {
const spy = jest.fn((obj) => obj);
const error = new AxiosError( const error = new AxiosError(
'Error message', 'Error message',
'409', '409',
@ -15,7 +16,9 @@ describe('formatAxiosError', () => {
} }
); );
expect(formatAxiosError(error, { formatMessage: (obj) => obj })).toStrictEqual({ formatAxiosError(error, { formatMessage: spy });
expect(spy).toHaveBeenCalledWith({
defaultMessage: 'Error message', defaultMessage: 'Error message',
id: 'apiError.Error message', id: 'apiError.Error message',
values: { values: {