mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
Enable guild challenge prize to use guild bank gems (#7840)
* add leader property to getGroups * Add test coverage
This commit is contained in:
parent
a8226b2363
commit
d51bd68201
3 changed files with 30 additions and 4 deletions
|
|
@ -46,7 +46,14 @@ describe('GET /challenges/:challengeId', () => {
|
|||
id: groupLeader._id,
|
||||
profile: {name: groupLeader.profile.name},
|
||||
});
|
||||
expect(chal.group).to.eql(_.pick(group, ['_id', 'id', 'name', 'type', 'privacy']));
|
||||
expect(chal.group).to.eql({
|
||||
_id: group._id,
|
||||
id: group.id,
|
||||
name: group.name,
|
||||
type: group.type,
|
||||
privacy: group.privacy,
|
||||
leader: groupLeader.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -91,7 +98,14 @@ describe('GET /challenges/:challengeId', () => {
|
|||
id: groupLeader._id,
|
||||
profile: {name: groupLeader.profile.name},
|
||||
});
|
||||
expect(chal.group).to.eql(_.pick(group, ['_id', 'id', 'name', 'type', 'privacy']));
|
||||
expect(chal.group).to.eql({
|
||||
_id: group._id,
|
||||
id: group.id,
|
||||
name: group.name,
|
||||
type: group.type,
|
||||
privacy: group.privacy,
|
||||
leader: groupLeader.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -136,7 +150,14 @@ describe('GET /challenges/:challengeId', () => {
|
|||
id: groupLeader.id,
|
||||
profile: {name: groupLeader.profile.name},
|
||||
});
|
||||
expect(chal.group).to.eql(_.pick(group, ['_id', 'id', 'name', 'type', 'privacy']));
|
||||
expect(chal.group).to.eql({
|
||||
_id: group._id,
|
||||
id: group.id,
|
||||
name: group.name,
|
||||
type: group.type,
|
||||
privacy: group.privacy,
|
||||
leader: groupLeader.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ describe('GET challenges/user', () => {
|
|||
type: publicGuild.type,
|
||||
privacy: publicGuild.privacy,
|
||||
name: publicGuild.name,
|
||||
leader: publicGuild.leader._id,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -64,6 +65,7 @@ describe('GET challenges/user', () => {
|
|||
type: publicGuild.type,
|
||||
privacy: publicGuild.privacy,
|
||||
name: publicGuild.name,
|
||||
leader: publicGuild.leader._id,
|
||||
});
|
||||
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
|
||||
expect(foundChallenge2).to.exist;
|
||||
|
|
@ -78,6 +80,7 @@ describe('GET challenges/user', () => {
|
|||
type: publicGuild.type,
|
||||
privacy: publicGuild.privacy,
|
||||
name: publicGuild.name,
|
||||
leader: publicGuild.leader._id,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -97,6 +100,7 @@ describe('GET challenges/user', () => {
|
|||
type: publicGuild.type,
|
||||
privacy: publicGuild.privacy,
|
||||
name: publicGuild.name,
|
||||
leader: publicGuild.leader._id,
|
||||
});
|
||||
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
|
||||
expect(foundChallenge2).to.exist;
|
||||
|
|
@ -111,6 +115,7 @@ describe('GET challenges/user', () => {
|
|||
type: publicGuild.type,
|
||||
privacy: publicGuild.privacy,
|
||||
name: publicGuild.name,
|
||||
leader: publicGuild.leader._id,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ schema.statics.sanitizeUpdate = function sanitizeUpdate (updateObj) {
|
|||
};
|
||||
|
||||
// Basic fields to fetch for populating a group info
|
||||
export let basicFields = 'name type privacy';
|
||||
export let basicFields = 'name type privacy leader';
|
||||
|
||||
schema.pre('remove', true, async function preRemoveGroup (next, done) {
|
||||
next();
|
||||
|
|
|
|||
Loading…
Reference in a new issue