mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-09 00:59:02 +02:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user