Skip to content

Commit 37116a8

Browse files
committed
Drop database between tests instead of removing collections.
1 parent 037c029 commit 37116a8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

spec/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function mockFacebook() {
227227
function clearData() {
228228
var promises = [];
229229
for (var conn in DatabaseAdapter.dbConnections) {
230-
promises.push(DatabaseAdapter.dbConnections[conn].deleteEverything());
230+
promises.push(DatabaseAdapter.dbConnections[conn].dropDatabase());
231231
}
232232
return Promise.all(promises);
233233
}

src/ExportAdapter.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,21 @@ ExportAdapter.prototype.deleteEverything = function() {
364364
var promises = [];
365365
for (var coll of colls) {
366366
if (!coll.namespace.match(/\.system\./) &&
367-
coll.collectionName.indexOf(this.collectionPrefix) === 0) {
367+
coll.collectionName.indexOf(this.collectionPrefix) === 0) {
368368
promises.push(coll.drop());
369369
}
370370
}
371371
return Promise.all(promises);
372372
});
373373
};
374374

375+
ExportAdapter.prototype.dropDatabase = () => {
376+
this.schemaPromise = null;
377+
return this.connect().then(() => {
378+
return this.db.dropDatabase();
379+
});
380+
};
381+
375382
// Finds the keys in a query. Returns a Set. REST format only
376383
function keysForQuery(query) {
377384
var sublist = query['$and'] || query['$or'];

0 commit comments

Comments
 (0)