forked from tari-project/tari
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e98ed1e
commit 4117b2a
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
applications/launchpad_v2/src/components/Text/Text.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
<ThemeProvider theme={themes.light}> | ||
<Text>{testText}</Text> | ||
</ThemeProvider>, | ||
) | ||
|
||
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( | ||
<ThemeProvider theme={themes.light}> | ||
<Text as={elType}>{testText}</Text> | ||
</ThemeProvider>, | ||
) | ||
|
||
const el = screen.getByTestId('text-cmp') | ||
expect(el.tagName.toLowerCase()).toBe(elType) | ||
}) | ||
}) |