forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from Arquisoft/Develop
Another error solved in deployment
- Loading branch information
Showing
13 changed files
with
17,948 additions
and
1,400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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('./game-service'); | ||
}); | ||
|
||
afterAll(async () => { | ||
app.close(); | ||
await mongoServer.stop(); | ||
}); | ||
|
||
describe('Game Service', () => { | ||
it('should add a new game on POST /addgame', async () => { | ||
const newGame = { | ||
user: '609c6e365308ce1a1c2658d1', | ||
questions: [ | ||
"609c6e365308ce1a1c2658d2", "609c6e365308ce1a1c2658d3" | ||
], | ||
answers: [ | ||
{ | ||
response: 'User response', | ||
isCorrect: true, | ||
}, | ||
], | ||
totalTime: 120, // Tiempo total de la partida en segundos | ||
}; | ||
|
||
const response = await request(app).post('/addgame').send(newGame); | ||
expect(response.status).toBe(200); | ||
expect(response.body).toHaveProperty('user', newGame.user.toString()); | ||
}); | ||
}); |
Oops, something went wrong.