Skip to content

Commit

Permalink
Updated test cases of notes
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-jain-94 committed Mar 9, 2018
1 parent a6494dd commit dff1dd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/notes/notes.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ router.get('/:noteId', async (req, res) => {
router.post('/', async (req, res) => {
const note = req.body;
const createdNote = await notesController.createNote(note);
res.json(JSON.stringify(createdNote));
res.json(createdNote);
});

module.exports = router;
7 changes: 3 additions & 4 deletions test/api/notes/notes.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Note Routes', () => {
should.exist(res.body);
res.body.should.be.an.instanceOf(Array);
const [noteSample] = res.body;
noteSample.should.have.properties(['title', 'body', 'createdAt', '_id']);
noteSample.should.have.only.keys('title', 'body', 'createdAt', '_id');
done();
});
});
Expand All @@ -45,7 +45,7 @@ describe('Note Routes', () => {
should.not.exist(err);
should.exist(res.body);
const noteSample = res.body;
noteSample.should.have.properties(['title', 'body', 'createdAt', '_id']);
noteSample.should.have.only.keys('title', 'body', 'createdAt', '_id');
done();
});
});
Expand All @@ -63,8 +63,7 @@ describe('Note Routes', () => {
should.not.exist(err);
should.exist(res.body);
const noteSample = res.body;
console.log(res.body);
noteSample.should.have.properties(['title', 'body', 'createdAt', '_id']);
noteSample.should.have.only.keys('title', 'body', 'createdAt', '_id');
noteSample.title.should.be.exactly('Test Note');
noteSample.body.should.be.exactly('Test Note Body');
done();
Expand Down

0 comments on commit dff1dd9

Please sign in to comment.