forked from Arquisoft/wiq_0
-
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
Showing
2 changed files
with
43 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,31 @@ | ||
import React from 'react'; | ||
import { render, screen, fireEvent } from '@testing-library/react'; | ||
import Nav from '../components/Nav'; | ||
|
||
describe('Nav component', () => { | ||
test('renders Nav component correctly', () => { | ||
const mockGoTo = jest.fn(); | ||
render(<Nav goTo={mockGoTo} />); | ||
|
||
// Verifica que los elementos del Nav se rendericen correctamente | ||
expect(screen.getByText('React Quiz')).toBeInTheDocument(); | ||
expect(screen.getByText('Volver al Menú')).toBeInTheDocument(); | ||
expect(screen.getByAltText('Remy Sharp')).toBeInTheDocument(); | ||
|
||
// Simula hacer clic en el botón de menú | ||
fireEvent.click(screen.getByLabelText('account of current user')); | ||
// Verifica que se abra el menú | ||
expect(screen.getByText('Profile')).toBeInTheDocument(); | ||
expect(screen.getByText('Logout')).toBeInTheDocument(); | ||
|
||
// Simula hacer clic en el botón de "Volver al Menú" | ||
fireEvent.click(screen.getByText('Volver al Menú')); | ||
// Verifica que la función goTo haya sido llamada con el parámetro correcto | ||
expect(mockGoTo).toHaveBeenCalledWith(1); | ||
|
||
// Simula hacer clic en el botón de "Logout" | ||
fireEvent.click(screen.getByText('Logout')); | ||
// Verifica que la función goTo haya sido llamada con el parámetro correcto | ||
expect(mockGoTo).toHaveBeenCalledWith(0); | ||
}); | ||
}); |
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,12 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { PostGame } from '../components/PostGame'; | ||
|
||
describe('PostGame component', () => { | ||
test('renders "FIN" text correctly', () => { | ||
render(<PostGame />); | ||
|
||
// Verifica que el texto "FIN" se renderice correctamente | ||
expect(screen.getByText('FIN')).toBeInTheDocument(); | ||
}); | ||
}); |