diff --git a/app.js b/app.js index ed928622c..d945d6254 100644 --- a/app.js +++ b/app.js @@ -52,6 +52,10 @@ if (app.get('env') === 'production') { // Enable the secure cookie when we are in production mode. session_opts.cookie.secure = true; +} else if (app.get('env') === 'test') { + + // Add in the secret during tests. + session_opts.secret = 'keyboard cat'; } app.use(session(session_opts)); diff --git a/tests/routes/api/comments/index.js b/tests/routes/api/comments/index.js index e635e988c..900cdac37 100644 --- a/tests/routes/api/comments/index.js +++ b/tests/routes/api/comments/index.js @@ -168,15 +168,13 @@ describe('Get moderation queues rejected, pending, flags', () => { }); }); - it('should return all the flagged comments', function(done){ - chai.request(app) + it('should return all the flagged comments', () => { + return chai.request(app) .get('/api/v1/comments/action/flag') - .end(function(err, res){ + .then((res) => { expect(res).to.have.status(200); - expect(err).to.be.null; expect(res.body.length).to.equal(1); expect(res.body[0]).to.have.property('id', 'abc'); - done(); }); }); }); @@ -392,11 +390,6 @@ describe('Remove /:comment_id', () => { }); }); -process.on('unhandledRejection', (reason) => { - console.error('Reason: '); - console.error(reason); -}); - describe('Post /:comment_id/status', () => { const comments = [{