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

@@ -1,15 +1,18 @@
import {
checkExistence,
generateGroup,
generateUser,
requester,
translate as t,
} from '../../helpers/api.helper';
describe('DELETE /user', () => {
let api;
let api, user;
beforeEach(() => {
return generateUser().then((user) => {
api = requester(user);
return generateUser().then((usr) => {
api = requester(usr);
user = usr;
});
});
@@ -26,11 +29,47 @@ describe('DELETE /user', () => {
it('does not delete account');
});
context('user in solo group', () => {
it('deletes party when user is the only member');
it('deletes private guild when user is the only member');
context('user in', () => {
context('solo group', () => {
let group;
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', () => {
@@ -41,4 +80,4 @@ describe('DELETE /user', () => {
it('removes invitations from groups');
});
});
});