-
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.
test(frontend): navigation works correctly
Signed-off-by: Márk Kővári <kovarimarkofficial@gmail.com>
- Loading branch information
1 parent
0db2977
commit 3b4fd60
Showing
1 changed file
with
46 additions
and
0 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,46 @@ | ||
import { render } from '@testing-library/react'; | ||
import { describe, it, expect } from 'vitest'; | ||
import { App } from './App'; | ||
import { act } from 'react'; | ||
|
||
|
||
describe('App', () => { | ||
it('should render successfully', () => { | ||
render(<App />); | ||
expect(true).toBe(true); | ||
}); | ||
|
||
it('should render the main page', () => { | ||
const { getByRole } = render(<App />); | ||
expect(getByRole('heading', { name: /Home/i })).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the login page after clicked on the login link', () => { | ||
const { getByRole } = render(<App />); | ||
|
||
act(() => { | ||
getByRole('link', { name: /login/i }).click(); | ||
}); | ||
expect(getByRole('heading', { name: /login/i })).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the main page after visited the register page and clicked on the home link', () => { | ||
const { getByRole } = render(<App />); | ||
|
||
act(() => { | ||
getByRole('link', { name: /main/i }).click(); | ||
}); | ||
expect(getByRole('heading', { name: /home/i })).toBeInTheDocument(); | ||
}); | ||
|
||
|
||
it('should render the register page after clicked on the register link', () => { | ||
const { getByRole } = render(<App />); | ||
|
||
act(() => { | ||
getByRole('link', { name: /register/i }).click(); | ||
}); | ||
expect(getByRole('heading', { name: /register/i })).toBeInTheDocument(); | ||
}); | ||
|
||
}); |