Fnished user in solo group tests

Also minor code cleanup in random files.
This commit is contained in:
Jeremy Abbott
2015-10-27 16:19:20 -05:00
parent 421b402948
commit 19128cf8f2
3 changed files with 49 additions and 11 deletions

View File

@@ -85,7 +85,7 @@ describe('POST /groups', () => {
code: 400, code: 400,
text: t('messageGroupAlreadyInParty'), text: t('messageGroupAlreadyInParty'),
}); });
}) });
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?', () => { 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', { return expect(api.post('/groups', {

View File

@@ -1,7 +1,6 @@
import { import {
checkExistence, checkExistence,
createAndPopulateGroup, createAndPopulateGroup,
generateGroup,
generateUser, generateUser,
requester, requester,
translate as t, translate as t,

View File

@@ -1,15 +1,18 @@
import { import {
checkExistence,
generateGroup,
generateUser, generateUser,
requester, requester,
translate as t, translate as t,
} from '../../helpers/api.helper'; } from '../../helpers/api.helper';
describe('DELETE /user', () => { describe('DELETE /user', () => {
let api; let api, user;
beforeEach(() => { beforeEach(() => {
return generateUser().then((user) => { return generateUser().then((usr) => {
api = requester(user); api = requester(usr);
user = usr;
}); });
}); });
@@ -26,11 +29,47 @@ describe('DELETE /user', () => {
it('does not delete account'); it('does not delete account');
}); });
context('user in solo group', () => { context('user in', () => {
it('deletes party when user is the only member'); context('solo group', () => {
let group;
it('deletes private guild when user is the only member'); beforeEach(() => {
return generateGroup(user, {
type: 'party',
privacy: 'private'
})
.then((grp) => {
group = grp;
});
});
it('deletes party when user is the only member', () => {
return expect(api.del('/user').then((duser) => {
return checkExistence('groups', group._id);
})).to.eventually.eql(false);
});
});
context('private guild', () => {
let guild;
beforeEach(() => {
return generateGroup(user, {
type: 'guild',
privacy: 'private'
})
.then((gld) => {
guild = gld;
});
});
it('deletes private guild when user is the only member', () => {
return expect(api.del('/user').then((duser) => {
return checkExistence('groups', guild._id);
})).to.eventually.eql(false);
});
});
}); });
context('user in group with members', () => { context('user in group with members', () => {