Made challenge paging optional

This commit is contained in:
Keith Holliday
2018-03-30 11:34:00 -05:00
parent 0d65e5219e
commit 2f69f4039e
3 changed files with 25 additions and 11 deletions

View File

@@ -249,6 +249,8 @@ describe('GET challenges/user', () => {
guild = group;
member = members[0];
await user.update({balance: 20});
for (let i = 0; i < 11; i += 1) {
await generateChallenge(user, group); // eslint-disable-line
}
@@ -262,8 +264,14 @@ describe('GET challenges/user', () => {
expect(challenges.length).to.eql(1);
});
it('paginates challenges', async () => {
it('does not page challenges if page parameter is absent', async () => {
const challenges = await user.get('/challenges/user');
expect(challenges.length).to.eql(12);
});
it('paginates challenges', async () => {
const challenges = await user.get('/challenges/user?page=0');
const challengesPaged = await user.get('/challenges/user?page=1&owned=owned');
expect(challenges.length).to.eql(10);