Jest test fails
Why is my jest mock failing here?
Getting this error
import '@testing-library/jest-dom';
import React, { Fragment } from 'react';
jest.mock('next-i18next', () => ({
Trans: ({ i18nKey, children }) => (
<Fragment>
{i18nKey}
{children}
</Fragment>
),
useTranslation: () => ({
i18n: {
changeLanguage: jest.fn(),
language: 'de',
},
t: key => key,
}),
}));
jest.mock('next/legacy/image', () => ({
__esModule: true,
default: () => 'Next legacy image stub',
}));
jest.mock('next/image', () => ({
__esModule: true,
default: () => 'Next image stub',
}));
window.google = {
maps: {
places: {
Autocomplete: class {},
AutocompleteService: class {},
AutocompleteSessionToken: class {},
PlacesService: class {},
},
},
};import '@testing-library/jest-dom';
import React, { Fragment } from 'react';
jest.mock('next-i18next', () => ({
Trans: ({ i18nKey, children }) => (
<Fragment>
{i18nKey}
{children}
</Fragment>
),
useTranslation: () => ({
i18n: {
changeLanguage: jest.fn(),
language: 'de',
},
t: key => key,
}),
}));
jest.mock('next/legacy/image', () => ({
__esModule: true,
default: () => 'Next legacy image stub',
}));
jest.mock('next/image', () => ({
__esModule: true,
default: () => 'Next image stub',
}));
window.google = {
maps: {
places: {
Autocomplete: class {},
AutocompleteService: class {},
AutocompleteSessionToken: class {},
PlacesService: class {},
},
},
};Getting this error
● Test suite failed to run
SyntaxError: /Users/code/myapp_monorepo/apps/main-frontend/jest.setup.js: Unexpected token, expected "," (8:6)
6 | <Fragment>
7 | {i18nKey}
> 8 | {children}
| ^
9 | </Fragment>
10 | ),
11 | useTranslation: () => ({ ● Test suite failed to run
SyntaxError: /Users/code/myapp_monorepo/apps/main-frontend/jest.setup.js: Unexpected token, expected "," (8:6)
6 | <Fragment>
7 | {i18nKey}
> 8 | {children}
| ^
9 | </Fragment>
10 | ),
11 | useTranslation: () => ({