mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
fix for travis?
This commit is contained in:
@@ -20,22 +20,29 @@ export async function checkExistence (collectionName, id) {
|
|||||||
// Specifically helpful for the GET /groups tests,
|
// Specifically helpful for the GET /groups tests,
|
||||||
// resets the db to an empty state and creates a tavern document
|
// resets the db to an empty state and creates a tavern document
|
||||||
export async function resetHabiticaDB () {
|
export async function resetHabiticaDB () {
|
||||||
|
console.log('calling resetHabiticaDatabase'); // eslint-disable-line
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
mongoose.connection.db.dropDatabase((dbErr) => {
|
mongoose.connection.db.dropDatabase((dbErr) => {
|
||||||
if (dbErr) return reject(dbErr);
|
if (dbErr) return reject(dbErr);
|
||||||
let groups = mongoose.connection.db.collection('groups');
|
let groups = mongoose.connection.db.collection('groups');
|
||||||
|
|
||||||
groups.insertOne({
|
// For some mysterious reason after a dropDatabase there can still be a group...
|
||||||
_id: 'habitrpg',
|
groups.count({_id: 'habitrpg'}, (err, count) => {
|
||||||
chat: [],
|
if (err) return reject(err);
|
||||||
leader: '9',
|
if (count > 0) return resolve();
|
||||||
name: 'HabitRPG',
|
|
||||||
type: 'guild',
|
|
||||||
privacy: 'public',
|
|
||||||
}, (insertErr) => {
|
|
||||||
if (insertErr) return reject(insertErr);
|
|
||||||
|
|
||||||
resolve();
|
groups.insertOne({
|
||||||
|
_id: 'habitrpg',
|
||||||
|
chat: [],
|
||||||
|
leader: '9',
|
||||||
|
name: 'HabitRPG',
|
||||||
|
type: 'guild',
|
||||||
|
privacy: 'public',
|
||||||
|
}, (insertErr) => {
|
||||||
|
if (insertErr) return reject(insertErr);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user