mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Updated test syntax and added get user challenges tests
This commit is contained in:
@@ -30,15 +30,19 @@ describe('GET challenges/group/:groupId', () => {
|
||||
it('should return group challenges for non member', async () => {
|
||||
let challenges = await nonMember.get(`/challenges/groups/${publicGuild._id}`);
|
||||
|
||||
expect(_.findIndex(challenges, {_id: challenge._id})).to.be.above(-1);
|
||||
expect(_.findIndex(challenges, {_id: challenge2._id})).to.be.above(-1);
|
||||
let foundChallenge1 = _.find(challenges, { _id: challenge._id });
|
||||
expect(foundChallenge1).to.exist;
|
||||
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
|
||||
expect(foundChallenge2).to.exist;
|
||||
});
|
||||
|
||||
it('should return group challenges for member', async () => {
|
||||
let challenges = await user.get(`/challenges/groups/${publicGuild._id}`);
|
||||
|
||||
expect(_.findIndex(challenges, {_id: challenge._id})).to.be.above(-1);
|
||||
expect(_.findIndex(challenges, {_id: challenge2._id})).to.be.above(-1);
|
||||
let foundChallenge1 = _.find(challenges, { _id: challenge._id });
|
||||
expect(foundChallenge1).to.exist;
|
||||
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
|
||||
expect(foundChallenge2).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,8 +79,10 @@ describe('GET challenges/group/:groupId', () => {
|
||||
it('should return group challenges for member', async () => {
|
||||
let challenges = await user.get(`/challenges/groups/${privateGuild._id}`);
|
||||
|
||||
expect(_.findIndex(challenges, {_id: challenge._id})).to.be.above(-1);
|
||||
expect(_.findIndex(challenges, {_id: challenge2._id})).to.be.above(-1);
|
||||
let foundChallenge1 = _.find(challenges, { _id: challenge._id });
|
||||
expect(foundChallenge1).to.exist;
|
||||
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
|
||||
expect(foundChallenge2).to.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user