I always get this error
Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
idk what's wrong with mocha tests hope someone helps (the post client works tho)
controller.js
module.exports.get_post_tags = (req, res) => {
PostTag.find({})
.then(tags => res.json(tags))
.catch(err => {
console.error(err)
res.send('An error happened while getting the data please try again later')
})
}
api.js
// @method GET
// @route /api/posttag
// @desc get all post tags
router.get('/posttags', get_post_tags)
unit_tests.js
describe('PostTag', function() {
it('Get all post tags', function(done) {
chai.request(app)
.get('/api/posttags')
.end((err, res) => {
expect(res).to.have.status(200)
done()
});
});
}