mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
Convert pending api tests to use promise syntax
This commit is contained in:
@@ -81,12 +81,7 @@ describe('GET /groups', () => {
|
||||
|
||||
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) => {
|
||||
api.get('/groups').then((groups) => {
|
||||
expect(groups.length).to.eql(4);
|
||||
done();
|
||||
}).catch(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');
|
||||
});
|
||||
|
||||
context('tavern passed in as query', () => {
|
||||
|
||||
@@ -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) => {
|
||||
api.post('/groups').then((group) => {
|
||||
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?', () => {
|
||||
return api.post('/groups').then((group) => {
|
||||
expect(group._id).to.exist;
|
||||
expect(group.name).to.eql(`${leader.profile.name}'s group`);
|
||||
expect(group.type).to.eql('party');
|
||||
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.');
|
||||
})
|
||||
|
||||
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) => {
|
||||
api.post('/groups', {
|
||||
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?', () => {
|
||||
return expect(api.post('/groups', {
|
||||
type: 'party',
|
||||
privacy: 'public',
|
||||
})
|
||||
.then((group) => {
|
||||
done('Unexpected success');
|
||||
})
|
||||
.catch((err) => {
|
||||
expect(err).to.eql('Parties must be private');
|
||||
done();
|
||||
});
|
||||
})).to.be.rejectedWith('Parties must be private');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user