-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: apply test at Resume TitleTooltip
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
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
28 changes: 28 additions & 0 deletions
28
apps/resume/src/components/TitleTooltip/TitleTooltip.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,28 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import TitleTooltip from './TitleTooltip'; | ||
|
||
describe('resume - components - TitleTooltip', () => { | ||
it('should render props', () => { | ||
const mockProps = { | ||
text: 'title', | ||
githubLink: 'github link', | ||
otherLink: 'github link', | ||
}; | ||
|
||
render(<TitleTooltip {...mockProps} />); | ||
expect(screen.getByText(mockProps.text)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not render button when does not have links', () => { | ||
const mockProps = { | ||
text: 'title', | ||
githubLink: null, | ||
otherLink: null, | ||
}; | ||
|
||
render(<TitleTooltip {...mockProps} />); | ||
expect(screen.queryByRole('button')).not.toBeInTheDocument(); | ||
}); | ||
}); |
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,19 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import Default from './index'; | ||
import TitleTooltip from './TitleTooltip'; | ||
|
||
const mockProps = { | ||
text: 'title', | ||
githubLink: 'github link', | ||
otherLink: 'github link', | ||
}; | ||
|
||
describe('resume - components - TitleTooltip index', () => { | ||
it('should render same things with TitleTooltip component', () => { | ||
const { container: defaultContainer } = render(<Default {...mockProps} />); | ||
const { container } = render(<TitleTooltip {...mockProps} />); | ||
expect(defaultContainer).toEqual(container); | ||
}); | ||
}); |