Skip to content

Commit

Permalink
TDD de questionservice
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276026 committed Apr 8, 2024
1 parent 30a56bf commit c61ea25
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 0 deletions.
162 changes: 162 additions & 0 deletions questionservice/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions questionservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"setprototypeof": "^1.2.0",
"side-channel": "^1.0.6",
"statuses": "^2.0.1",
"supertest": "^6.3.4",
"toidentifier": "^1.0.1",
"type-is": "^1.6.18",
"unpipe": "^1.0.0",
Expand Down
16 changes: 16 additions & 0 deletions questionservice/server.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const request = require('supertest');
const axios = require('axios');
const app = require('./server');
const fs = require('fs');

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 c61ea25

Please sign in to comment.