Skip to content

Commit

Permalink
Create server.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
UO277938 authored Apr 9, 2024
1 parent eff17c1 commit 041e654
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions questionservice/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const request = require('supertest');
const app = require('./server');
const fs = require('fs');

afterAll(async () => {
app.close();
});

describe('GET /pregunta', () => {
it('debería devolver una pregunta y respuestas con éxito', async () => {
const response = await request(app).get('/pregunta');
expect(response.statusCode).toBe(200);
expect(response.body).toHaveProperty('question');
expect(response.body).toHaveProperty('answerGood');
expect(response.body).toHaveProperty('answers');
expect(response.body.answers).toHaveLength(4);
});



});

0 comments on commit 041e654

Please sign in to comment.