Adjust delete route test to use promises

This commit is contained in:
Blade Barringer
2015-10-25 08:16:21 -05:00
parent 69d48cb98e
commit 27cb5881cd

View File

@@ -6,25 +6,16 @@ import {
describe('DELETE /user', () => { describe('DELETE /user', () => {
let api; let api;
beforeEach((done) => { beforeEach(() => {
generateUser().then((usr) => { return generateUser().then((user) => {
api = requester(usr); api = requester(user);
done(); })
}).catch(done);
}); });
it('deletes the user', (done) => { it('deletes the user', () => {
api.del('/user') return expect(api.del('/user').then((fetchedUser) => {
.then((fetchedUser) => {
return api.get('/user'); return api.get('/user');
}) })).to.be.rejectedWith('No user found.');
.then((deletedUser) => {
done('Unexpected user');
})
.catch((err) => {
expect(err).to.eql('No user found.');
done();
});
}); });
context('user in solo group', () => { context('user in solo group', () => {