From 8027e2deed61a135c4ebe2c588f8c04476b3a102 Mon Sep 17 00:00:00 2001 From: divlo Date: Tue, 20 Apr 2021 18:23:05 +0200 Subject: [PATCH] test: improve coverage --- __test__/pages/404.test.tsx | 10 ++++++++++ __test__/pages/500.test.tsx | 10 ++++++++++ components/{Footer/index.tsx => Footer.tsx} | 0 components/Header/__test__/Header.test.tsx | 10 ++++++++++ components/__test__/ErrorPage.test.tsx | 15 +++++++++++++++ components/__test__/Footer.test.tsx | 10 ++++++++++ components/design/__test__/Input.test.tsx | 11 +++++++++++ jest.config.js | 3 ++- 8 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 __test__/pages/404.test.tsx create mode 100644 __test__/pages/500.test.tsx rename components/{Footer/index.tsx => Footer.tsx} (100%) create mode 100644 components/Header/__test__/Header.test.tsx create mode 100644 components/__test__/ErrorPage.test.tsx create mode 100644 components/__test__/Footer.test.tsx create mode 100644 components/design/__test__/Input.test.tsx diff --git a/__test__/pages/404.test.tsx b/__test__/pages/404.test.tsx new file mode 100644 index 0000000..72a2032 --- /dev/null +++ b/__test__/pages/404.test.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react' + +import Error404 from 'pages/404' + +describe('GET /404', () => { + it('should render', async () => { + const { getByText } = render() + expect(getByText('404')).toBeInTheDocument() + }) +}) diff --git a/__test__/pages/500.test.tsx b/__test__/pages/500.test.tsx new file mode 100644 index 0000000..4d9d3b1 --- /dev/null +++ b/__test__/pages/500.test.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react' + +import Error500 from 'pages/500' + +describe('GET /500', () => { + it('should render', async () => { + const { getByText } = render() + expect(getByText('500')).toBeInTheDocument() + }) +}) diff --git a/components/Footer/index.tsx b/components/Footer.tsx similarity index 100% rename from components/Footer/index.tsx rename to components/Footer.tsx diff --git a/components/Header/__test__/Header.test.tsx b/components/Header/__test__/Header.test.tsx new file mode 100644 index 0000000..d960b96 --- /dev/null +++ b/components/Header/__test__/Header.test.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react' + +import { Header } from '..' + +describe('
', () => { + it('should render', async () => { + const { getByText } = render(
) + expect(getByText('Divlo')).toBeInTheDocument() + }) +}) diff --git a/components/__test__/ErrorPage.test.tsx b/components/__test__/ErrorPage.test.tsx new file mode 100644 index 0000000..b84f95c --- /dev/null +++ b/components/__test__/ErrorPage.test.tsx @@ -0,0 +1,15 @@ +import { render } from '@testing-library/react' + +import { ErrorPage } from '../ErrorPage' + +describe('', () => { + it('should render the message and statusCode', async () => { + const messageContent = 'message content' + const statusCode = 404 + const { getByText } = render( + + ) + expect(getByText(messageContent)).toBeInTheDocument() + expect(getByText(statusCode)).toBeInTheDocument() + }) +}) diff --git a/components/__test__/Footer.test.tsx b/components/__test__/Footer.test.tsx new file mode 100644 index 0000000..4991403 --- /dev/null +++ b/components/__test__/Footer.test.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react' + +import { Footer } from '../Footer' + +describe('