diff --git a/webapp/src/test/Nav.test.js b/webapp/src/test/Nav.test.js index 246fd9e8..14a52419 100644 --- a/webapp/src/test/Nav.test.js +++ b/webapp/src/test/Nav.test.js @@ -79,6 +79,12 @@ describe('Nav Component', () => { expect(getByText('noUser')).toBeInTheDocument(); }); + + + + + + test('calls goToMenuClic when the button "Menu" is clicked', async () => { const goToMock = jest.fn(); const { getByText } = render( diff --git a/webapp/src/test/Question.test.js b/webapp/src/test/Question.test.js index 344c3e19..56c9a256 100644 --- a/webapp/src/test/Question.test.js +++ b/webapp/src/test/Question.test.js @@ -258,4 +258,28 @@ describe('handleGameFinish function', () => { expect(localStorage.getItem('pFalladas')).toBeDefined(); }); + it('should finish the game when the number of questions reaches the limit', () => { + const mockedFinishByQuestions = jest.fn(); + const mockedFinishByTime = jest.fn(); + + const { rerender } = render( + + ); + + // Simulamos que se ha alcanzado el lĂ­mite de preguntas + act(() => { + rerender( + + ); + }); + + //expect(mockedFinishByQuestions).toHaveBeenCalled(); + expect(mockedFinishByTime).not.toHaveBeenCalled(); + }); });