Skip to content

Commit

Permalink
updated game service tests
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276976 committed Mar 4, 2024
1 parent ac25f92 commit 945bf18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gameservice/game-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ app.post('/addgame', async (req, res) => {

res.status(201).json(savedGame);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error' });
res.status(500).json({ error: error.message });
}
});

Expand Down
13 changes: 2 additions & 11 deletions gameservice/game-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,9 @@ afterAll(async () => {
describe('Game Service', () => {
it('should add a new game on POST /addgame', async () => {
const newGame = {
user: 'testUser',
user: '609c6e365308ce1a1c2658d1',
questions: [
{
question: 'Mocked Question',
correct: 'Mocked Correct Answer',
incorrects: ['Mocked Option 1', 'Mocked Option 2']
},
{
question: 'Mocked Question2',
correct: 'Mocked Correct Answer2',
incorrects: ['Mocked Option 1', 'Mocked Option 2']
}
"609c6e365308ce1a1c2658d2", "609c6e365308ce1a1c2658d3"
],
answers: [
{
Expand Down
4 changes: 2 additions & 2 deletions questionservice/question-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ app.post('/addquestion', async (req, res) => {
// Guarda la nueva pregunta en la base de datos
const savedQuestion = await newQuestion.save();

res.status(1).json(savedQuestion);
res.status(201).json(savedQuestion);
} catch (error) {
res.status(500).json({ error: 'Internal Server Error' });
res.status(500).json({ error: error.message });
}
});

Expand Down

0 comments on commit 945bf18

Please sign in to comment.