diff --git a/webapp/src/components/GeneratedQuestionsList.test.js b/webapp/src/components/GeneratedQuestionsList.test.js index 4554cd02..b09c09d3 100644 --- a/webapp/src/components/GeneratedQuestionsList.test.js +++ b/webapp/src/components/GeneratedQuestionsList.test.js @@ -33,26 +33,26 @@ describe('GeneratedQuestionsList component', () => { }); }); - test('renders GeneratedQuestionsList component and main heading', async () => { + async function render(){ await act( async () => { render( {}} />); }); + } + + test('renders GeneratedQuestionsList component and main heading', async () => { + await render(); const heading = screen.getByRole('heading', { name: /Lista de preguntas/i }); expect(heading).toBeInTheDocument(); }); it('should display the table', async () => { - await act( async () => { - render( {}} />); - }); + await render(); const table = screen.getByRole('table'); expect(table).toBeInTheDocument(); }); test('renders table headers', async () => { - await act( async () => { - render( {}} />); - }); + await render(); const questionHeader = screen.getByRole('columnheader', { name: /Pregunta/i }); const answerHeader = screen.getByRole('columnheader', { name: /Respuesta Correcta/i }); expect(questionHeader).toBeInTheDocument(); @@ -60,9 +60,7 @@ describe('GeneratedQuestionsList component', () => { }); test('renders table rows', async () => { - await act( async () => { - render( {}} />); - }); + await render(); const tableRows = screen.getAllByRole('row'); expect(tableRows).not.toHaveLength(0); }); @@ -98,6 +96,10 @@ describe('GeneratedQuestionsList component', () => { }); test('should order questions by answer correctly', async () => { + await act(async () => { + render( {}} />); + }); + const answerHeader = screen.getByRole('columnheader', { name: /Respuesta Correcta/i }); await act(async() => {