Convert pending api tests to use promise syntax

This commit is contained in:
Blade Barringer
2015-10-25 11:21:19 -05:00
parent 829b1253fb
commit 8e282738f5
2 changed files with 6 additions and 21 deletions

View File

@@ -81,12 +81,7 @@ describe('GET /groups', () => {
context('no query passed in', () => { context('no query passed in', () => {
xit('lists all public guilds, the tavern, user\'s party, and any private guilds that user is a part of - TODO query includes duplicates - IE, tavern is included as tavern and part of public guilds. Refactor so this is not the case', (done) => { xit('lists all public guilds, the tavern, user\'s party, and any private guilds that user is a part of - TODO query includes duplicates - IE, tavern is included as tavern and part of public guilds. Refactor so this is not the case');
api.get('/groups').then((groups) => {
expect(groups.length).to.eql(4);
done();
}).catch(done);
});
}); });
context('tavern passed in as query', () => { context('tavern passed in as query', () => {

View File

@@ -16,15 +16,12 @@ describe('POST /groups', () => {
}); });
}); });
xit('returns defaults? (TODO: it\'s possible to create a group without a type. Should the group default to party? Should we require type to be set?', (done) => { xit('returns defaults? (TODO: it\'s possible to create a group without a type. Should the group default to party? Should we require type to be set?', () => {
api.post('/groups').then((group) => { return api.post('/groups').then((group) => {
expect(group._id).to.exist; expect(group._id).to.exist;
expect(group.name).to.eql(`${leader.profile.name}'s group`); expect(group.name).to.eql(`${leader.profile.name}'s group`);
expect(group.type).to.eql('party'); expect(group.type).to.eql('party');
expect(group.privacy).to.eql('private'); expect(group.privacy).to.eql('private');
done();
}).catch((err) => {
done(err);
}); });
}); });
@@ -86,18 +83,11 @@ describe('POST /groups', () => {
})).to.be.rejectedWith('Already in a party, try refreshing.'); })).to.be.rejectedWith('Already in a party, try refreshing.');
}) })
xit('prevents creating a public party. TODO: it is possible to create a public party. Should we send back an error? Automatically switch the privacy to private?', (done) => { xit('prevents creating a public party. TODO: it is possible to create a public party. Should we send back an error? Automatically switch the privacy to private?', () => {
api.post('/groups', { return expect(api.post('/groups', {
type: 'party', type: 'party',
privacy: 'public', privacy: 'public',
}) })).to.be.rejectedWith('Parties must be private');
.then((group) => {
done('Unexpected success');
})
.catch((err) => {
expect(err).to.eql('Parties must be private');
done();
});
}); });
}); });