api v3 adapt v2: correctly import dependencies, port create, get, list groups

This commit is contained in:
Matteo Pagliazzi
2016-04-04 23:18:49 +02:00
parent f6fc50f6c2
commit 0a40c56973
17 changed files with 258 additions and 123 deletions

View File

@@ -4,11 +4,11 @@ import {
resetHabiticaDB,
} from '../../../helpers/api-integration/v2';
xdescribe('GET /groups', () => {
describe('GET /groups', () => {
const NUMBER_OF_PUBLIC_GUILDS = 3;
const NUMBER_OF_USERS_GUILDS = 2;
let user;
let leader;
before(async () => {
// Set up a world with a mixture of public and private guilds
@@ -16,7 +16,7 @@ xdescribe('GET /groups', () => {
await resetHabiticaDB();
user = await generateUser();
let leader = await generateUser({ balance: 10 });
leader = await generateUser({ balance: 10 });
await generateGroup(leader, {
name: 'public guild - is member',
@@ -90,8 +90,8 @@ xdescribe('GET /groups', () => {
context('guilds passed in as query', () => {
it('returns all guilds user is a part of ', async () => {
await expect(user.get('/groups', null, {type: 'guilds'}))
.to.eventually.have.a.lengthOf(NUMBER_OF_USERS_GUILDS);
await expect(leader.get('/groups', null, {type: 'guilds'}))
.to.eventually.have.a.lengthOf(4);
});
});
});