Skip to content

Commit

Permalink
another try to make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
uo289029 committed Apr 27, 2024
1 parent b9784b2 commit 5e303bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions questionsgenerator/questions-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const sinonMongoose = require('sinon-mongoose');
const Question = require('./question-model');
const Template = require('./templates/template-model');
const QuestionGenerator = require('./questionGenerator.js');
const mongoose = require('mongoose');

let mongoServer;
let app;
Expand All @@ -29,23 +30,22 @@ beforeAll(async () => {
//mock the deleteOne from the service
const deleteOneStub = sinon.stub(Question, 'deleteOne');
deleteOneStub.resolves({ n: 1 });

});

afterAll(async () => {
await mongoServer.stop();
await app.close();
sinon.restore();
app.close();
await mongoose.connection.close();
await mongoServer.stop();
});

describe('Questions Service', () => {
it('should get a new question on POST /getQuestion', async () => {
/**const category = "todo";
it('should get a new question on GET /getQuestion', async () => {
const category = "todo";

const response = await request(app).get('/getQuestion').query({ category });;
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('question');
expect(response.body).toHaveProperty('correctAnswerLabel');
expect(response.body).toHaveProperty('answerLabelSet');**/
expect(response.body).toHaveProperty('answerLabelSet');
});
});

0 comments on commit 5e303bb

Please sign in to comment.