Skip to content

Commit

Permalink
help test
Browse files Browse the repository at this point in the history
  • Loading branch information
uo288574 committed Apr 28, 2024
1 parent f3b51fb commit 4b3ab9e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 120 deletions.
120 changes: 0 additions & 120 deletions webapp/src/components/game/Game.js

This file was deleted.

40 changes: 40 additions & 0 deletions webapp/src/help/Help.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react';
import { render, fireEvent, screen, waitFor, act } from '@testing-library/react';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import Help from './Help';
import { ContextFun } from '../components/Context';
import { BrowserRouter as Router } from 'react-router-dom';

const mockAxios = new MockAdapter(axios);

describe("Help for game", () => {

beforeEach(() => {
mockAxios.reset();
});

test("renders GameConfig",async () => {
render(
<ContextFun>
<Router>
<Help/>
</Router>
</ContextFun>
);

expect(screen.getByText(/Cómo jugar/i)).toBeInTheDocument();
const preElements = document.getElementsByTagName('pre');
expect(preElements.length).toBe(3);
expect(preElements[0]).toHaveTextContent('Cuando inicies');
expect(preElements[1]).toHaveTextContent('Cada vez que');
expect(preElements[2]).toHaveTextContent('¡Demuestra');
const ulElements = document.getElementsByTagName('ul');
expect(ulElements.length).toBe(1);
const liElements = document.getElementsByTagName('li');
expect(liElements.length).toBe(4);
expect(screen.getByText(/¡Demuestra tus conocimientos!/i)).toBeInTheDocument();
});

});

0 comments on commit 4b3ab9e

Please sign in to comment.