Merge pull request #3185 from overleaf/jpa-normalize-mongo-imports

[misc] normalize mongo imports

GitOrigin-RevId: ac653d9982e0d36736b90f4c03d4c00be88ea76a
This commit is contained in:
Jakob Ackermann 2020-09-23 10:49:26 +02:00 committed by Copybot
parent 2977d6ab9b
commit 018a44eeb5
69 changed files with 63 additions and 86 deletions

View file

@ -6,7 +6,7 @@ const PrivilegeLevels = require('./PrivilegeLevels')
const TokenAccessHandler = require('../TokenAccess/TokenAccessHandler') const TokenAccessHandler = require('../TokenAccess/TokenAccessHandler')
const PublicAccessLevels = require('./PublicAccessLevels') const PublicAccessLevels = require('./PublicAccessLevels')
const Errors = require('../Errors/Errors') const Errors = require('../Errors/Errors')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const { promisifyAll } = require('../../util/promises') const { promisifyAll } = require('../../util/promises')
const AuthorizationManager = { const AuthorizationManager = {

View file

@ -2,7 +2,7 @@ let AuthorizationMiddleware
const AuthorizationManager = require('./AuthorizationManager') const AuthorizationManager = require('./AuthorizationManager')
const async = require('async') const async = require('async')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Errors = require('../Errors/Errors') const Errors = require('../Errors/Errors')
const HttpErrorHandler = require('../Errors/HttpErrorHandler') const HttpErrorHandler = require('../Errors/HttpErrorHandler')
const AuthenticationController = require('../Authentication/AuthenticationController') const AuthenticationController = require('../Authentication/AuthenticationController')

View file

@ -1,6 +1,6 @@
const { callbackify } = require('util') const { callbackify } = require('util')
const pLimit = require('p-limit') const pLimit = require('p-limit')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')

View file

@ -1,6 +1,6 @@
const async = require('async') const async = require('async')
const _ = require('underscore') const _ = require('underscore')
const { ObjectId } = require('../../infrastructure/mongojs') const { ObjectId } = require('mongodb')
const { getInstitutionAffiliations } = require('./InstitutionsAPI') const { getInstitutionAffiliations } = require('./InstitutionsAPI')
const FeaturesUpdater = require('../Subscription/FeaturesUpdater') const FeaturesUpdater = require('../Subscription/FeaturesUpdater')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')

View file

@ -13,7 +13,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let ProjectCollabratecDetailsHandler let ProjectCollabratecDetailsHandler
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
module.exports = ProjectCollabratecDetailsHandler = { module.exports = ProjectCollabratecDetailsHandler = {

View file

@ -4,7 +4,7 @@ const fs = require('fs')
const crypto = require('crypto') const crypto = require('crypto')
const async = require('async') const async = require('async')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const { ObjectId } = require('../../infrastructure/mongojs') const { ObjectId } = require('mongodb')
const ProjectDeleter = require('./ProjectDeleter') const ProjectDeleter = require('./ProjectDeleter')
const ProjectDuplicator = require('./ProjectDuplicator') const ProjectDuplicator = require('./ProjectDuplicator')
const ProjectCreationHandler = require('./ProjectCreationHandler') const ProjectCreationHandler = require('./ProjectCreationHandler')

View file

@ -17,7 +17,7 @@ const OError = require('@overleaf/o-error')
const async = require('async') const async = require('async')
const metrics = require('metrics-sharelatex') const metrics = require('metrics-sharelatex')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')
const { Folder } = require('../../models/Folder') const { Folder } = require('../../models/Folder')
const ProjectEntityUpdateHandler = require('./ProjectEntityUpdateHandler') const ProjectEntityUpdateHandler = require('./ProjectEntityUpdateHandler')

View file

@ -13,11 +13,9 @@
* DS207: Consider shorter variations of null checks * DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const mongojs = require('../../infrastructure/mongojs') const { db, ObjectId } = require('../../infrastructure/mongojs')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const metrics = require('metrics-sharelatex') const metrics = require('metrics-sharelatex')
const { db } = mongojs
const { ObjectId } = mongojs
const async = require('async') const async = require('async')
const { promisifyAll } = require('../../util/promises') const { promisifyAll } = require('../../util/promises')
const { Project } = require('../../models/Project') const { Project } = require('../../models/Project')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../infrastructure/mongojs') const { ObjectId } = require('mongodb')
const _ = require('lodash') const _ = require('lodash')
const { promisify } = require('util') const { promisify } = require('util')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')

View file

@ -16,7 +16,6 @@ const { promisify } = require('util')
const { Subscription } = require('../../models/Subscription') const { Subscription } = require('../../models/Subscription')
const { DeletedSubscription } = require('../../models/DeletedSubscription') const { DeletedSubscription } = require('../../models/DeletedSubscription')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const { ObjectId } = require('mongoose').Types
require('./GroupPlansData') // make sure dynamic group plans are loaded require('./GroupPlansData') // make sure dynamic group plans are loaded
const SubscriptionLocator = { const SubscriptionLocator = {

View file

@ -1,4 +1,4 @@
const { db } = require('../../infrastructure/mongojs') const { db, ObjectId } = require('../../infrastructure/mongojs')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const async = require('async') const async = require('async')
const { promisifyAll } = require('../../util/promises') const { promisifyAll } = require('../../util/promises')
@ -6,7 +6,6 @@ const { Subscription } = require('../../models/Subscription')
const SubscriptionLocator = require('./SubscriptionLocator') const SubscriptionLocator = require('./SubscriptionLocator')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
const PlansLocator = require('./PlansLocator') const PlansLocator = require('./PlansLocator')
const { ObjectId } = require('mongoose').Types
const FeaturesUpdater = require('./FeaturesUpdater') const FeaturesUpdater = require('./FeaturesUpdater')
const { DeletedSubscription } = require('../../models/DeletedSubscription') const { DeletedSubscription } = require('../../models/DeletedSubscription')

View file

@ -4,7 +4,7 @@ const crypto = require('crypto')
const async = require('async') const async = require('async')
const settings = require('settings-sharelatex') const settings = require('settings-sharelatex')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const { Subscription } = require('../../models/Subscription') const { Subscription } = require('../../models/Subscription')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../infrastructure/mongojs') const { ObjectId } = require('mongodb')
const _ = require('lodash') const _ = require('lodash')
const { callbackify } = require('util') const { callbackify } = require('util')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')

View file

@ -2,7 +2,7 @@ const { Project } = require('../../models/Project')
const PublicAccessLevels = require('../Authorization/PublicAccessLevels') const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
const PrivilegeLevels = require('../Authorization/PrivilegeLevels') const PrivilegeLevels = require('../Authorization/PrivilegeLevels')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const V1Api = require('../V1/V1Api') const V1Api = require('../V1/V1Api')

View file

@ -1,8 +1,6 @@
const mongojs = require('../../infrastructure/mongojs') const { db, ObjectId } = require('../../infrastructure/mongojs')
const metrics = require('metrics-sharelatex') const metrics = require('metrics-sharelatex')
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const { db } = mongojs
const { ObjectId } = mongojs
const { promisifyAll } = require('../../util/promises') const { promisifyAll } = require('../../util/promises')
const { getUserAffiliations } = require('../Institutions/InstitutionsAPI') const { getUserAffiliations } = require('../Institutions/InstitutionsAPI')
const InstitutionsHelper = require('../Institutions/InstitutionsHelper') const InstitutionsHelper = require('../Institutions/InstitutionsHelper')

View file

@ -1,7 +1,7 @@
let UserController let UserController
const UserGetter = require('./UserGetter') const UserGetter = require('./UserGetter')
const AuthenticationController = require('../Authentication/AuthenticationController') const AuthenticationController = require('../Authentication/AuthenticationController')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
module.exports = UserController = { module.exports = UserController = {
getLoggedInUsersPersonalInfo(req, res, next) { getLoggedInUsersPersonalInfo(req, res, next) {

View file

@ -1,10 +1,8 @@
const logger = require('logger-sharelatex') const logger = require('logger-sharelatex')
const OError = require('@overleaf/o-error') const OError = require('@overleaf/o-error')
const mongojs = require('../../infrastructure/mongojs') const { db, ObjectId } = require('../../infrastructure/mongojs')
const metrics = require('metrics-sharelatex') const metrics = require('metrics-sharelatex')
const { db } = mongojs
const async = require('async') const async = require('async')
const { ObjectId } = mongojs
const { callbackify, promisify } = require('util') const { callbackify, promisify } = require('util')
const UserGetter = require('./UserGetter') const UserGetter = require('./UserGetter')
const { const {

View file

@ -13,7 +13,7 @@
* DS207: Consider shorter variations of null checks * DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
const async = require('async') const async = require('async')
const { promisifyAll } = require('../../util/promises') const { promisifyAll } = require('../../util/promises')
const Errors = require('../Errors/Errors') const Errors = require('../Errors/Errors')

View file

@ -11,7 +11,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
let UserMembershipViewModel let UserMembershipViewModel
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const UserGetter = require('../User/UserGetter') const UserGetter = require('../User/UserGetter')
module.exports = UserMembershipViewModel = { module.exports = UserMembershipViewModel = {

View file

@ -1,5 +1,5 @@
const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate') const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate')
const { ObjectId } = require('./mongojs') const { ObjectId } = require('mongodb')
const objectIdValidator = { const objectIdValidator = {
name: 'objectId', name: 'objectId',

View file

@ -15,7 +15,6 @@ const assert = require('assert')
require('chai').should() require('chai').should()
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const { ObjectId } = require('mongojs')
const modulePath = require('path').join( const modulePath = require('path').join(
__dirname, __dirname,
'../../../app/src/LaunchpadController.js' '../../../app/src/LaunchpadController.js'

View file

@ -1,5 +1,4 @@
const mongojs = require('../app/src/infrastructure/mongojs') const { db } = require('../app/src/infrastructure/mongojs')
const { db } = mongojs
const async = require('async') const async = require('async')
const minilist = require('minimist') const minilist = require('minimist')

View file

@ -1,5 +1,4 @@
const mongojs = require('../app/src/infrastructure/mongojs') const { db } = require('../app/src/infrastructure/mongojs')
const { db } = mongojs
const async = require('async') const async = require('async')
const minilist = require('minimist') const minilist = require('minimist')

View file

@ -1,5 +1,4 @@
const mongojs = require('../../app/src/infrastructure/mongojs') const { db } = require('../../app/src/infrastructure/mongojs')
const { db } = mongojs
const keys = { 'tokens.readAndWritePrefix': 1 } const keys = { 'tokens.readAndWritePrefix': 1 }
const opts = { const opts = {

View file

@ -1,5 +1,4 @@
const mongojs = require('../../app/src/infrastructure/mongojs') const { db, ObjectId } = require('../../app/src/infrastructure/mongojs')
const { db, ObjectId } = mongojs
const Async = require('async') const Async = require('async')
const projectIds = [ const projectIds = [

View file

@ -1,5 +1,4 @@
const mongojs = require('../../app/src/infrastructure/mongojs') const { db } = require('../../app/src/infrastructure/mongojs')
const { db } = mongojs
const Async = require('async') const Async = require('async')
db.projects.find( db.projects.find(

View file

@ -1,5 +1,4 @@
const mongojs = require('../../app/src/infrastructure/mongojs') const { db } = require('../../app/src/infrastructure/mongojs')
const { db } = mongojs
const async = require('async') const async = require('async')
db.deletedSubscriptions.aggregate( db.deletedSubscriptions.aggregate(

View file

@ -1,7 +1,6 @@
const NotificationsHandler = require('../../app/src/Features/Notifications/NotificationsHandler') const NotificationsHandler = require('../../app/src/Features/Notifications/NotificationsHandler')
const mongojs = require('../../app/src/infrastructure/mongojs') const { db } = require('../../app/src/infrastructure/mongojs')
const { db } = mongojs
const async = require('async') const async = require('async')
const templateKey = 'wfh_2020_upgrade_offer' const templateKey = 'wfh_2020_upgrade_offer'

View file

@ -1,7 +1,6 @@
const NotificationsHandler = require('../../app/src/Features/Notifications/NotificationsHandler') const NotificationsHandler = require('../../app/src/Features/Notifications/NotificationsHandler')
const mongojs = require('../../app/src/infrastructure/mongojs') const { db } = require('../../app/src/infrastructure/mongojs')
const { db } = mongojs
const async = require('async') const async = require('async')
const templateKey = 'wfh_2020_upgrade_offer' const templateKey = 'wfh_2020_upgrade_offer'

View file

@ -17,7 +17,7 @@ const async = require('async')
const UserClient = require('./helpers/User') const UserClient = require('./helpers/User')
const request = require('./helpers/request') const request = require('./helpers/request')
const settings = require('settings-sharelatex') const settings = require('settings-sharelatex')
const { ObjectId } = require('../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const { Subscription } = require('../../../app/src/models/Subscription') const { Subscription } = require('../../../app/src/models/Subscription')
const { User } = require('../../../app/src/models/User') const { User } = require('../../../app/src/models/User')
const FeaturesUpdater = require('../../../app/src/Features/Subscription/FeaturesUpdater') const FeaturesUpdater = require('../../../app/src/Features/Subscription/FeaturesUpdater')

View file

@ -13,7 +13,7 @@
*/ */
const _ = require('underscore') const _ = require('underscore')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const request = require('./helpers/request') const request = require('./helpers/request')
const MockProjectHistoryApi = require('./helpers/MockProjectHistoryApi') const MockProjectHistoryApi = require('./helpers/MockProjectHistoryApi')

View file

@ -1,7 +1,7 @@
const { expect } = require('chai') const { expect } = require('chai')
const User = require('./helpers/User').promises const User = require('./helpers/User').promises
const { Project } = require('../../../app/src/models/Project') const { Project } = require('../../../app/src/models/Project')
const { ObjectId } = require('../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
describe('Project CRUD', function() { describe('Project CRUD', function() {
beforeEach(async function() { beforeEach(async function() {

View file

@ -19,7 +19,6 @@ const async = require('async')
const { expect } = require('chai') const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const mkdirp = require('mkdirp') const mkdirp = require('mkdirp')
const { ObjectId } = require('mongojs')
const Path = require('path') const Path = require('path')
const fs = require('fs') const fs = require('fs')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')

View file

@ -1,6 +1,6 @@
const { expect } = require('chai') const { expect } = require('chai')
const mkdirp = require('mkdirp') const mkdirp = require('mkdirp')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Path = require('path') const Path = require('path')
const fs = require('fs') const fs = require('fs')
const Settings = require('settings-sharelatex') const Settings = require('settings-sharelatex')

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const InstitutionModel = require('../../../../app/src/models/Institution') const InstitutionModel = require('../../../../app/src/models/Institution')
.Institution .Institution

View file

@ -3,7 +3,7 @@ const _ = require('lodash')
const express = require('express') const express = require('express')
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const app = express() const app = express()
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
module.exports = MockProjectHistoryApi = { module.exports = MockProjectHistoryApi = {
docs: {}, docs: {},

View file

@ -16,7 +16,6 @@ const _ = require('lodash')
const express = require('express') const express = require('express')
const bodyParser = require('body-parser') const bodyParser = require('body-parser')
const app = express() const app = express()
const { ObjectId } = require('mongojs')
module.exports = MockV1HistoryApi = { module.exports = MockV1HistoryApi = {
fakeZipCall: 0, fakeZipCall: 0,

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const PublisherModel = require('../../../../app/src/models/Publisher').Publisher const PublisherModel = require('../../../../app/src/models/Publisher').Publisher
let count = parseInt(Math.random() * 999999) let count = parseInt(Math.random() * 999999)

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const Subscription = require('./Subscription') const Subscription = require('./Subscription')
const MockRecurlyApi = require('./MockRecurlyApi') const MockRecurlyApi = require('./MockRecurlyApi')
const RecurlyWrapper = require('../../../../app/src/Features/Subscription/RecurlyWrapper') const RecurlyWrapper = require('../../../../app/src/Features/Subscription/RecurlyWrapper')

View file

@ -7,7 +7,7 @@ const SandboxedModule = require('sandboxed-module')
const tk = require('timekeeper') const tk = require('timekeeper')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
describe('AuthenticationController', function() { describe('AuthenticationController', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const chai = require('chai') const chai = require('chai')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors') const AuthenticationErrors = require('../../../../app/src/Features/Authentication/AuthenticationErrors')
chai.should() chai.should()

View file

@ -36,7 +36,7 @@ describe('AuthorizationMiddleware', function() {
requires: { requires: {
'./AuthorizationManager': this.AuthorizationManager, './AuthorizationManager': this.AuthorizationManager,
'logger-sharelatex': { log() {} }, 'logger-sharelatex': { log() {} },
mongojs: { mongodb: {
ObjectId: this.ObjectId ObjectId: this.ObjectId
}, },
'../Errors/HttpErrorHandler': this.HttpErrorHandler, '../Errors/HttpErrorHandler': this.HttpErrorHandler,

View file

@ -2,7 +2,7 @@ const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon') const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')

View file

@ -5,7 +5,7 @@ const sinon = require('sinon')
const { expect } = require('chai') const { expect } = require('chai')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const MODULE_PATH = path.join( const MODULE_PATH = path.join(
__dirname, __dirname,

View file

@ -21,7 +21,7 @@ const SandboxedModule = require('sandboxed-module')
const events = require('events') const events = require('events')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
describe('CollaboratorsInviteController', function() { describe('CollaboratorsInviteController', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -22,7 +22,7 @@ const modulePath =
'../../../../app/src/Features/Collaborators/CollaboratorsInviteHandler.js' '../../../../app/src/Features/Collaborators/CollaboratorsInviteHandler.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const events = require('events') const events = require('events')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Crypto = require('crypto') const Crypto = require('crypto')
describe('CollaboratorsInviteHandler', function() { describe('CollaboratorsInviteHandler', function() {

View file

@ -1,7 +1,7 @@
const sinon = require('sinon') const sinon = require('sinon')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const path = require('path') const path = require('path')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const modulePath = path.join( const modulePath = path.join(
__dirname, __dirname,
'../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler' '../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler'

View file

@ -83,7 +83,7 @@ describe('InstitutionsManager', function() {
'../Subscription/SubscriptionLocator': this.SubscriptionLocator, '../Subscription/SubscriptionLocator': this.SubscriptionLocator,
'../../models/Institution': this.InstitutionModel, '../../models/Institution': this.InstitutionModel,
'../../models/Subscription': SubscriptionModel, '../../models/Subscription': SubscriptionModel,
'../../infrastructure/mongojs': this.Mongo, mongodb: this.Mongo,
'../User/SAMLIdentityManager': this.SAMLIdentityManager '../User/SAMLIdentityManager': this.SAMLIdentityManager
} }
})) }))

View file

@ -11,7 +11,7 @@
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Path = require('path') const Path = require('path')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('assert')

View file

@ -7,7 +7,7 @@ const tk = require('timekeeper')
const moment = require('moment') const moment = require('moment')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')
const { DeletedProject } = require('../helpers/models/DeletedProject') const { DeletedProject } = require('../helpers/models/DeletedProject')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('ProjectDeleter', function() { describe('ProjectDeleter', function() {

View file

@ -20,7 +20,6 @@ const { expect } = chai
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Project/ProjectEntityHandler' const modulePath = '../../../../app/src/Features/Project/ProjectEntityHandler'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongoose').Types
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('ProjectEntityHandler', function() { describe('ProjectEntityHandler', function() {

View file

@ -2,7 +2,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const tk = require('timekeeper') const tk = require('timekeeper')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { Project } = require('../helpers/models/Project') const { Project } = require('../helpers/models/Project')

View file

@ -3,7 +3,7 @@ const { expect } = chai
const sinon = require('sinon') const sinon = require('sinon')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
const MODULE_PATH = const MODULE_PATH =
'../../../../app/src/Features/Project/ProjectEntityUpdateHandler' '../../../../app/src/Features/Project/ProjectEntityUpdateHandler'

View file

@ -17,7 +17,7 @@ const should = chai.should()
const { expect } = chai const { expect } = chai
const modulePath = '../../../../app/src/Features/Project/ProjectGetter.js' const modulePath = '../../../../app/src/Features/Project/ProjectGetter.js'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const { assert } = require('chai') const { assert } = require('chai')
describe('ProjectGetter', function() { describe('ProjectGetter', function() {

View file

@ -1,7 +1,7 @@
const chai = require('chai') const chai = require('chai')
const { expect } = chai const { expect } = chai
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const MODULE_PATH = '../../../../app/src/Features/Project/ProjectHelper.js' const MODULE_PATH = '../../../../app/src/Features/Project/ProjectHelper.js'

View file

@ -19,7 +19,6 @@ const { expect } = chai
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Project/ProjectHistoryHandler' const modulePath = '../../../../app/src/Features/Project/ProjectHistoryHandler'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const { ObjectId } = require('mongoose').Types
describe('ProjectHistoryHandler', function() { describe('ProjectHistoryHandler', function() {
const project_id = '4eecb1c1bffa66588e0000a1' const project_id = '4eecb1c1bffa66588e0000a1'

View file

@ -16,7 +16,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const modulePath = '../../../../app/src/Features/Subscription/FeaturesUpdater' const modulePath = '../../../../app/src/Features/Subscription/FeaturesUpdater'
const { assert } = require('chai') const { assert } = require('chai')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
describe('FeaturesUpdater', function() { describe('FeaturesUpdater', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -17,7 +17,6 @@ const sinon = require('sinon')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/SubscriptionLocator' '../../../../app/src/Features/Subscription/SubscriptionLocator'
const { assert } = require('chai') const { assert } = require('chai')
const { ObjectId } = require('mongoose').Types
describe('Subscription Locator Tests', function() { describe('Subscription Locator Tests', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -4,7 +4,7 @@ const sinon = require('sinon')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/SubscriptionUpdater' '../../../../app/src/Features/Subscription/SubscriptionUpdater'
const { assert } = require('chai') const { assert } = require('chai')
const { ObjectId } = require('mongoose').Types const { ObjectId } = require('mongodb')
chai.should() chai.should()

View file

@ -4,7 +4,7 @@ const { expect } = require('chai')
const modulePath = const modulePath =
'../../../../app/src/Features/Subscription/TeamInvitesHandler' '../../../../app/src/Features/Subscription/TeamInvitesHandler'
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const Errors = require('../../../../app/src/Features/Errors/Errors') const Errors = require('../../../../app/src/Features/Errors/Errors')
describe('TeamInvitesHandler', function() { describe('TeamInvitesHandler', function() {

View file

@ -3,7 +3,7 @@ const { expect } = require('chai')
require('chai').should() require('chai').should()
const sinon = require('sinon') const sinon = require('sinon')
const { Tag } = require('../helpers/models/Tag') const { Tag } = require('../helpers/models/Tag')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const modulePath = require('path').join( const modulePath = require('path').join(
__dirname, __dirname,
'../../../../app/src/Features/Tags/TagsHandler.js' '../../../../app/src/Features/Tags/TagsHandler.js'

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const chai = require('chai') const chai = require('chai')
const path = require('path') const path = require('path')

View file

@ -21,7 +21,7 @@ const modulePath = path.join(
'../../../../app/src/Features/TokenAccess/TokenAccessHandler' '../../../../app/src/Features/TokenAccess/TokenAccessHandler'
) )
const { expect } = require('chai') const { expect } = require('chai')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
describe('TokenAccessHandler', function() { describe('TokenAccessHandler', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -1,4 +1,4 @@
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const should = require('chai').should() const should = require('chai').should()
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const assert = require('assert') const assert = require('assert')

View file

@ -20,7 +20,7 @@ const SandboxedModule = require('sandboxed-module')
const events = require('events') const events = require('events')
const MockResponse = require('../helpers/MockResponse') const MockResponse = require('../helpers/MockResponse')
const MockRequest = require('../helpers/MockRequest') const MockRequest = require('../helpers/MockRequest')
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
describe('UserInfoController', function() { describe('UserInfoController', function() {
beforeEach(function() { beforeEach(function() {

View file

@ -1,7 +1,7 @@
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
const modulePath = const modulePath =
'../../../../app/src/Features/User/UserOnboardingController.js' '../../../../app/src/Features/User/UserOnboardingController.js'
const { ObjectId } = require('mongojs') const { ObjectId } = require('mongodb')
const sinon = require('sinon') const sinon = require('sinon')
describe('UserOnboardingController', function() { describe('UserOnboardingController', function() {

View file

@ -17,7 +17,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const assertCalledWith = sinon.assert.calledWith const assertCalledWith = sinon.assert.calledWith
const assertNotCalled = sinon.assert.notCalled const assertNotCalled = sinon.assert.notCalled
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const modulePath = const modulePath =
'../../../../app/src/Features/UserMembership/UserMembershipHandler' '../../../../app/src/Features/UserMembership/UserMembershipHandler'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')

View file

@ -16,8 +16,7 @@ const { expect } = require('chai')
const sinon = require('sinon') const sinon = require('sinon')
const assertCalledWith = sinon.assert.calledWith const assertCalledWith = sinon.assert.calledWith
const assertNotCalled = sinon.assert.notCalled const assertNotCalled = sinon.assert.notCalled
const mongojs = require('mongojs') const { ObjectId } = require('mongodb')
const { ObjectId } = mongojs
const modulePath = const modulePath =
'../../../../app/src/Features/UserMembership/UserMembershipViewModel' '../../../../app/src/Features/UserMembership/UserMembershipViewModel'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')
@ -30,7 +29,7 @@ describe('UserMembershipViewModel', function() {
console: console console: console
}, },
requires: { requires: {
mongojs: mongojs, mongodb: require('mongodb'),
'../User/UserGetter': this.UserGetter '../User/UserGetter': this.UserGetter
} }
}) })

View file

@ -12,7 +12,7 @@
*/ */
const sinon = require('sinon') const sinon = require('sinon')
const assertCalledWith = sinon.assert.calledWith const assertCalledWith = sinon.assert.calledWith
const { ObjectId } = require('../../../../app/src/infrastructure/mongojs') const { ObjectId } = require('mongodb')
const modulePath = const modulePath =
'../../../../app/src/Features/UserMembership/UserMembershipsHandler' '../../../../app/src/Features/UserMembership/UserMembershipsHandler'
const SandboxedModule = require('sandboxed-module') const SandboxedModule = require('sandboxed-module')