generated from Arquisoft/wiq_0
-
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.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
1 changed file
with
52 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,52 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import Ayuda from './Ayuda'; | ||
|
||
const mockNavigate = jest.fn(); | ||
|
||
jest.mock('react-router-dom', () => ({ | ||
...jest.requireActual('react-router-dom'), | ||
useNavigate: () => mockNavigate, | ||
})); | ||
|
||
describe('Help Tests', () => { | ||
beforeEach(() => { | ||
// Limpiar mocks antes de cada prueba | ||
mockNavigate.mockClear(); | ||
}); | ||
|
||
test('renders Help', () => { | ||
render( | ||
<BrowserRouter> | ||
<Ayuda /> | ||
</BrowserRouter> | ||
); | ||
|
||
// Verifica que estan los elementos | ||
expect(screen.getByText(/AYUDA (WIQ 4D)/i)).toBeInTheDocument(); | ||
|
||
// verifica las secciones | ||
expect(screen.getByText(/Registro e Inicio de Sesión/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Cómo Jugar/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Historial y Ranking/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/API REST de la aplicación/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Otras Funcionalidades/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/Contacto/i)).toBeInTheDocument(); | ||
|
||
// verifica el video | ||
expect(screen.getByTestId('help-video')).toHaveAttribute('src', '/videos/help.mp4'); | ||
|
||
// verifica los links | ||
expect(screen.getByText('[email protected]')).toBeInTheDocument(); | ||
expect(screen.getByText('[email protected]')).toBeInTheDocument(); | ||
expect(screen.getByText('[email protected]')).toBeInTheDocument(); | ||
}); | ||
|
||
|
||
}); | ||
|
||
async function wait(milliseconds) { | ||
jest.advanceTimersByTime(milliseconds); | ||
} |