v3: GET /groups accept a guilds type which returns all the guilds the user is a member of

This commit is contained in:
Matteo Pagliazzi
2016-05-03 15:49:47 +02:00
parent f0e696b0ec
commit 21d798bca7
3 changed files with 26 additions and 10 deletions

View File

@@ -9,7 +9,8 @@ import {
describe('GET /groups', () => {
let user;
const NUMBER_OF_PUBLIC_GUILDS = 3;
const NUMBER_OF_PUBLIC_GUILDS = 3; // 2 + the tavern
const NUMBER_OF_PUBLIC_GUILDS_USER_IS_MEMBER = 1;
const NUMBER_OF_USERS_PRIVATE_GUILDS = 1;
const NUMBER_OF_GROUPS_USER_CAN_VIEW = 5;
@@ -87,6 +88,11 @@ describe('GET /groups', () => {
.to.eventually.have.a.lengthOf(NUMBER_OF_PUBLIC_GUILDS);
});
it('returns all the user\'s guilds when guilds passed in as query', async () => {
await expect(user.get('/groups?type=guilds'))
.to.eventually.have.a.lengthOf(NUMBER_OF_PUBLIC_GUILDS_USER_IS_MEMBER + NUMBER_OF_USERS_PRIVATE_GUILDS);
});
it('returns all private guilds user is a part of when privateGuilds passed in as query', async () => {
await expect(user.get('/groups?type=privateGuilds'))
.to.eventually.have.a.lengthOf(NUMBER_OF_USERS_PRIVATE_GUILDS);