generated from gabrielduete/frontend-template-nextjs
-
Notifications
You must be signed in to change notification settings - Fork 1
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
6860eea
commit c8ea85b
Showing
4 changed files
with
38 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react' | ||
|
||
import Home from './index.page' | ||
|
||
describe('<Home />', () => { | ||
beforeAll(() => { | ||
window.Element.prototype.animate = jest.fn() | ||
}) | ||
|
||
it('should render the title and explore link', () => { | ||
render(<Home />) | ||
|
||
expect(screen.getAllByText('sandevistan')[0]).toBeInTheDocument() | ||
expect(screen.getByText('explore')).toBeInTheDocument() | ||
}) | ||
|
||
it('should navigate to the about page when explore link is clicked', () => { | ||
render(<Home />) | ||
window.open = jest.fn() | ||
|
||
const exploreLink = screen.getByText('explore') | ||
|
||
fireEvent.click(exploreLink) | ||
|
||
expect(window.open).toHaveBeenCalledTimes(1) | ||
expect(window.open).toHaveBeenCalledWith('/about', '_self', 'noreferrer') | ||
}) | ||
}) |
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
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
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