Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Verzidee committed Apr 24, 2024
2 parents cf7d431 + 6bd9fef commit 756000b
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions webapp/src/components/pages/Ayuda.test.js
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);
}

0 comments on commit 756000b

Please sign in to comment.