add population to challenge.group, challenge.leader and group.leader

This commit is contained in:
Matteo Pagliazzi
2016-02-02 21:47:12 +01:00
parent 509dffd0c7
commit 7a5aa731db
13 changed files with 207 additions and 62 deletions

View File

@@ -32,12 +32,17 @@ describe('POST /group', () => {
});
it('sets the group leader to the user who created the group', async () => {
await expect(
user.post('/groups', {
name: 'Test Public Guild',
type: 'guild',
})
).to.eventually.have.property('leader', user._id);
let group = await user.post('/groups', {
name: 'Test Public Guild',
type: 'guild',
});
expect(group.leader).to.eql({
_id: user._id,
profile: {
name: user.profile.name,
},
});
});
});
@@ -86,6 +91,12 @@ describe('POST /group', () => {
expect(publicGuild.type).to.equal(groupType);
expect(publicGuild.memberCount).to.equal(1);
expect(publicGuild.privacy).to.equal(groupPrivacy);
expect(publicGuild.leader).to.eql({
_id: user._id,
profile: {
name: user.profile.name,
},
});
});
});
@@ -106,6 +117,12 @@ describe('POST /group', () => {
expect(privateGuild.type).to.equal(groupType);
expect(privateGuild.memberCount).to.equal(1);
expect(privateGuild.privacy).to.equal(groupPrivacy);
expect(privateGuild.leader).to.eql({
_id: user._id,
profile: {
name: user.profile.name,
},
});
});
it('deducts gems from user and adds them to guild bank', async () => {
@@ -138,6 +155,12 @@ describe('POST /group', () => {
expect(party.name).to.equal(partyName);
expect(party.type).to.equal(partyType);
expect(party.memberCount).to.equal(1);
expect(party.leader).to.eql({
_id: user._id,
profile: {
name: user.profile.name,
},
});
});
it('does not require gems to create a party', async () => {