mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
useAPIErrorHandler: Stop testing react-intl internals
This commit is contained in:
parent
b53f260ecf
commit
7f11c8bbdf
@ -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: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user