Merge pull request #3183 from overleaf/jpa-add-missing-db-stub

[misc] unit tests: add missing module stubs for (transient) db imports

GitOrigin-RevId: 9a16f1ab9b42608d839922fb339189697bc9ed22
This commit is contained in:
Jakob Ackermann
2020-09-23 10:50:14 +02:00
committed by Copybot
parent 018a44eeb5
commit 9789a158a7
2 changed files with 11 additions and 0 deletions
@@ -5,6 +5,16 @@
// Fix any style issues and re-enable lint.
const Settings = require('settings-sharelatex')
const mongojs = require('mongojs')
if (
typeof global.beforeEach === 'function' &&
process.argv.join(' ').match(/unit/)
) {
throw new Error(
'It looks like unit tests are running, but you are connecting to Mongo. Missing a stub?'
)
}
const db = mongojs(Settings.mongo.url, [
'projects',
'users',
@@ -110,6 +110,7 @@ describe('SubscriptionUpdater', function() {
warn() {}
},
'settings-sharelatex': this.Settings,
'../../infrastructure/mongojs': { db: {}, ObjectId },
'./FeaturesUpdater': this.FeaturesUpdater,
'../../models/DeletedSubscription': {
DeletedSubscription: this.DeletedSubscription