From c8da895ba42a8dd20b072118652139670325d5ad Mon Sep 17 00:00:00 2001 From: baraganio Date: Mon, 22 Apr 2024 14:25:45 +0200 Subject: [PATCH] Test por defecto (se crea pero no comrpueba nada) --- .../creationservice/creation-service.test.js | 25 +++++++++++++++++++ .../retrieveservice/retrieve-service.test.js | 25 +++++++++++++++++++ 2 files changed, 50 insertions(+) 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