diff --git a/question_generator/questionGenerationService.test.js b/question_generator/questionGenerationService.test.js index 9364b837..a6f7461a 100644 --- a/question_generator/questionGenerationService.test.js +++ b/question_generator/questionGenerationService.test.js @@ -1,14 +1,15 @@ const request = require('supertest'); const axios = require('axios'); -const app = require('./questionGenerationService'); +let app; -beforeAll(() => { +beforeAll(async () => { jest.useFakeTimers(); + app = require('./questionGenerationService'); }); afterAll(async () => { - await app.close(); - jest.useRealTimers(); + app.close(); + jest.useRealTimers(); }); describe('Question generation service', () => { @@ -30,9 +31,9 @@ describe('Question generation service', () => { expect(response.body).toHaveProperty('question'); expect(response.body).toHaveProperty('correct'); expect(response.body).toHaveProperty('incorrects'); - }); + }, 100000); - it('should forward create question request to question generation service with sports category', async () => { + it('should forward create question request to question generation service', async () => { const response = await request(app) .get('/api/questions/create?category=sports'); @@ -40,9 +41,9 @@ describe('Question generation service', () => { expect(response.body).toHaveProperty('question'); expect(response.body).toHaveProperty('correct'); expect(response.body).toHaveProperty('incorrects'); - }); + },100000); - it('should forward create question request to question generation service with geography category', async () => { + it('should forward create question request to question generation service', async () => { const response = await request(app) .get('/api/questions/create?category=geography'); @@ -50,5 +51,5 @@ describe('Question generation service', () => { expect(response.body).toHaveProperty('question'); expect(response.body).toHaveProperty('correct'); expect(response.body).toHaveProperty('incorrects'); - }); + },100000); }); \ No newline at end of file