diff --git a/webapp/src/components/Question.test.js b/webapp/src/components/Question.test.js index dd59304..8dff1c0 100644 --- a/webapp/src/components/Question.test.js +++ b/webapp/src/components/Question.test.js @@ -38,4 +38,29 @@ describe('Question page', () => { imgs = screen.getAllByRole("button") expect(imgs.length).toBe(4) }); -}); \ No newline at end of file + + + it('should render a flags question if category is foods', async () => { + useAuthUser.mockReturnValue({ username: 'testUser' }); + + mockAxios.onGet('http://localhost:8000/imgs/foods/question').reply(200, + { + question: "Which of the following images corresponds to Tortilla?", + images:["TortillaImage","PaellaImage","CachopoImage","ChocoImage"] + }); + + render(); + + await waitFor(() => { + expect(screen.getByText(/Which of the following images corresponds to/i)).toBeInTheDocument(); + expect(screen.getByText(/Score/i)).toBeInTheDocument(); + }); + + let imgs = [] + imgs = screen.getAllByRole("button") + expect(imgs.length).toBe(4) + }); +}); + + +