diff --git a/jest.config.js b/jest.config.js index 05e36dfd4..10886cb18 100644 --- a/jest.config.js +++ b/jest.config.js @@ -22,6 +22,7 @@ const customJestConfig = { moduleNameMapper: { '^@/(.*)$': '/src/$1', '^~/(.*)$': '/public/$1', + '^.+\\.(svg)$': '/src/__mocks__/svg.tsx', }, }; diff --git a/src/__mocks__/svg.tsx b/src/__mocks__/svg.tsx new file mode 100644 index 000000000..f973aa328 --- /dev/null +++ b/src/__mocks__/svg.tsx @@ -0,0 +1,8 @@ +import React, { SVGProps } from 'react'; + +const SvgrMock = React.forwardRef>( + (props, ref) => +); + +export const ReactComponent = SvgrMock; +export default SvgrMock; diff --git a/src/__tests__/pages/HomePage.test.tsx b/src/__tests__/pages/HomePage.test.tsx new file mode 100644 index 000000000..f2fb81df3 --- /dev/null +++ b/src/__tests__/pages/HomePage.test.tsx @@ -0,0 +1,15 @@ +// !STARTERCONF You should delete this page + +import { render, screen } from '@testing-library/react'; + +import HomePage from '@/app/page'; + +describe('Homepage', () => { + it('renders the Components', () => { + render(); + + const heading = screen.getByText(/A starter for Next.js/i); + + expect(heading).toBeInTheDocument(); + }); +});