Added fallback for secret during testing

This commit is contained in:
Wyatt Johnson
2016-11-10 17:22:14 -07:00
parent 6867760099
commit 6c13e1c1c9
2 changed files with 7 additions and 10 deletions
+4
View File
@@ -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));
+3 -10
View File
@@ -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 = [{