From 4117b2ae867141c476f5fabe11e500f6d52b72be Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 27 Apr 2022 20:46:16 +0200 Subject: [PATCH] Add Text test (#106) --- .../src/components/Text/Text.test.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 applications/launchpad_v2/src/components/Text/Text.test.tsx diff --git a/applications/launchpad_v2/src/components/Text/Text.test.tsx b/applications/launchpad_v2/src/components/Text/Text.test.tsx new file mode 100644 index 0000000000..d956dfa336 --- /dev/null +++ b/applications/launchpad_v2/src/components/Text/Text.test.tsx @@ -0,0 +1,33 @@ +import { render, screen } from '@testing-library/react' +import { ThemeProvider } from 'styled-components' + +import Text from './' + +import themes from '../../styles/themes' + +describe('Text', () => { + it('should render Text component without crashing', () => { + const testText = 'The test text' + render( + + {testText} + , + ) + + const el = screen.getByText(testText) + expect(el).toBeInTheDocument() + }) + + it('should render DOM element of the given type', () => { + const testText = 'The test text' + const elType = 'span' + render( + + {testText} + , + ) + + const el = screen.getByTestId('text-cmp') + expect(el.tagName.toLowerCase()).toBe(elType) + }) +})