Merge pull request #30 from coralproject/fix-settings-test

fix a race condition in the tests
This commit is contained in:
Kim Gardner
2016-11-08 12:27:37 -05:00
committed by GitHub
+10 -5
View File
@@ -38,17 +38,18 @@ describe('update settings', () => {
return Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true}); return Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true});
}); });
it('should respond to a PUT with new settings', () => { it('should respond ok to a PUT', () => {
chai.request(app) chai.request(app)
.put('/api/v1/settings') .put('/api/v1/settings')
.send({moderation: 'post'}, (err, res) => { .send({moderation: 'post'}, (err, res) => {
expect(err).to.be.null; expect(err).to.be.null;
expect(res).to.have.status(204); expect(res).to.have.status(204);
done(err);
});
});
it('should have updates settings', () => { if (err) {
return done(err);
}
// confirm have updated settings
chai.request(app) chai.request(app)
.get('/api/v1/settings') .get('/api/v1/settings')
.end((err, res) => { .end((err, res) => {
@@ -57,6 +58,10 @@ describe('update settings', () => {
expect(res).to.be.json; expect(res).to.be.json;
expect(res.body).to.have.property('moderation'); expect(res.body).to.have.property('moderation');
expect(res.body.moderation).to.equal('post'); expect(res.body.moderation).to.equal('post');
done(err);
}); });
}); });
});
}); });