mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
make tests working with new tavern id
This commit is contained in:
@@ -3,6 +3,9 @@ import {
|
|||||||
resetHabiticaDB,
|
resetHabiticaDB,
|
||||||
generateGroup,
|
generateGroup,
|
||||||
} from '../../../../helpers/api-v3-integration.helper';
|
} from '../../../../helpers/api-v3-integration.helper';
|
||||||
|
import {
|
||||||
|
TAVERN_ID,
|
||||||
|
} from '../../../../../website/src/models/group';
|
||||||
|
|
||||||
describe('GET /groups', () => {
|
describe('GET /groups', () => {
|
||||||
let user;
|
let user;
|
||||||
@@ -70,7 +73,7 @@ describe('GET /groups', () => {
|
|||||||
await expect(user.get('/groups?type=tavern'))
|
await expect(user.get('/groups?type=tavern'))
|
||||||
.to.eventually.have.a.lengthOf(1)
|
.to.eventually.have.a.lengthOf(1)
|
||||||
.and.to.have.deep.property('[0]')
|
.and.to.have.deep.property('[0]')
|
||||||
.and.to.have.property('_id', 'habitrpg');
|
.and.to.have.property('_id', TAVERN_ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns only the user\'s party when party passed in as query', async () => {
|
it('returns only the user\'s party when party passed in as query', async () => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
|
import { TAVERN_ID } from '../../website/src/models/group';
|
||||||
|
|
||||||
// Useful for checking things that have been deleted,
|
// Useful for checking things that have been deleted,
|
||||||
// but you no longer have access to,
|
// but you no longer have access to,
|
||||||
@@ -26,12 +27,12 @@ export async function resetHabiticaDB () {
|
|||||||
let groups = mongoose.connection.db.collection('groups');
|
let groups = mongoose.connection.db.collection('groups');
|
||||||
|
|
||||||
// For some mysterious reason after a dropDatabase there can still be a group...
|
// For some mysterious reason after a dropDatabase there can still be a group...
|
||||||
groups.count({_id: 'habitrpg'}, (err, count) => {
|
groups.count({_id: TAVERN_ID}, (err, count) => {
|
||||||
if (err) return reject(err);
|
if (err) return reject(err);
|
||||||
if (count > 0) return resolve();
|
if (count > 0) return resolve();
|
||||||
|
|
||||||
groups.insertOne({
|
groups.insertOne({
|
||||||
_id: 'habitrpg',
|
_id: TAVERN_ID,
|
||||||
chat: [],
|
chat: [],
|
||||||
leader: '9',
|
leader: '9',
|
||||||
name: 'HabitRPG',
|
name: 'HabitRPG',
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ function cron (options = {}) {
|
|||||||
gaLabel: 'Cron Count',
|
gaLabel: 'Cron Count',
|
||||||
gaValue: user.flags.cronCount,
|
gaValue: user.flags.cronCount,
|
||||||
uuid: user._id,
|
uuid: user._id,
|
||||||
user, // TODO is it really necessary passing the whole user object?
|
|
||||||
resting: user.preferences.sleep,
|
resting: user.preferences.sleep,
|
||||||
cronCount: user.flags.cronCount,
|
cronCount: user.flags.cronCount,
|
||||||
progressUp: _.min([_progress.up, 900]),
|
progressUp: _.min([_progress.up, 900]),
|
||||||
|
|||||||
Reference in New Issue
Block a user