diff --git a/questions/creationservice/creation-service.test.js b/questions/creationservice/creation-service.test.js index e69de29b..f59cf619 100644 --- a/questions/creationservice/creation-service.test.js +++ b/questions/creationservice/creation-service.test.js @@ -0,0 +1,25 @@ +const request = require('supertest'); +const { MongoMemoryServer } = require('mongodb-memory-server'); + +let mongoServer; +let app; + +beforeAll(async () => { + mongoServer = await MongoMemoryServer.create(); + const mongoUri = mongoServer.getUri(); + process.env.MONGODB_URI = mongoUri; + app = require('./createquestion-service'); +}); + +afterAll(async () => { + app.close(); + await mongoServer.stop(); +}); + +describe('Retrieve Service', () => { + it('should add a new user on GET /createquestion', async () => { + + const response = await request(app).get('/createquestion'); + expect(response.status).toBe(200); + }); +}); \ No newline at end of file diff --git a/questions/retrieveservice/retrieve-service.test.js b/questions/retrieveservice/retrieve-service.test.js index e69de29b..74bbccab 100644 --- a/questions/retrieveservice/retrieve-service.test.js +++ b/questions/retrieveservice/retrieve-service.test.js @@ -0,0 +1,25 @@ +const request = require('supertest'); +const { MongoMemoryServer } = require('mongodb-memory-server'); + +let mongoServer; +let app; + +beforeAll(async () => { + mongoServer = await MongoMemoryServer.create(); + const mongoUri = mongoServer.getUri(); + process.env.MONGODB_URI = mongoUri; + app = require('./retrieve-service'); +}); + +afterAll(async () => { + app.close(); + await mongoServer.stop(); +}); + +describe('Retrieve Service', () => { + it('should add a new user on GET /getquestionshistory', async () => { + + const response = await request(app).get('/getquestionshistory'); + expect(response.status).toBe(200); + }); +}); \ No newline at end of file