Merge pull request #3348 from overleaf/revert-3298-jpa-re-land-mongoose-latest

Revert "[misc] re-land: remove mongojs and bump mongoose"

GitOrigin-RevId: 45a284435c88898d96769ab258651fb8d6d20ff5
This commit is contained in:
Jakob Ackermann
2020-11-02 15:57:41 +01:00
committed by Copybot
parent 6a837ce457
commit e249a2e5be
60 changed files with 671 additions and 454 deletions

View File

@@ -27,7 +27,7 @@ describe('ProjectUpdateHandler', function() {
beforeEach(function() {
let Project
this.ProjectModel = Project = class Project {}
this.ProjectModel.updateOne = sinon.stub().callsArg(3)
this.ProjectModel.update = sinon.stub().callsArg(3)
return (this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
@@ -53,7 +53,7 @@ describe('ProjectUpdateHandler', function() {
this.lastUpdatedBy,
err => {
sinon.assert.calledWith(
this.ProjectModel.updateOne,
this.ProjectModel.update,
{
_id: this.project_id,
lastUpdated: { $lt: this.lastUpdatedAt }
@@ -71,7 +71,7 @@ describe('ProjectUpdateHandler', function() {
it('should set smart fallbacks', function(done) {
return this.handler.markAsUpdated(this.project_id, null, null, err => {
sinon.assert.calledWithMatch(
this.ProjectModel.updateOne,
this.ProjectModel.update,
{
_id: this.project_id,
lastUpdated: { $lt: this.fakeTime }
@@ -90,7 +90,7 @@ describe('ProjectUpdateHandler', function() {
it('should send an update to mongo', function(done) {
const project_id = 'project_id'
return this.handler.markAsOpened(project_id, err => {
const args = this.ProjectModel.updateOne.args[0]
const args = this.ProjectModel.update.args[0]
args[0]._id.should.equal(project_id)
const date = args[1].lastOpened + ''
const now = Date.now() + ''
@@ -104,7 +104,7 @@ describe('ProjectUpdateHandler', function() {
it('should send an update to mongo', function(done) {
const project_id = 'project_id'
return this.handler.markAsInactive(project_id, err => {
const args = this.ProjectModel.updateOne.args[0]
const args = this.ProjectModel.update.args[0]
args[0]._id.should.equal(project_id)
args[1].active.should.equal(false)
return done()
@@ -116,7 +116,7 @@ describe('ProjectUpdateHandler', function() {
it('should send an update to mongo', function(done) {
const project_id = 'project_id'
return this.handler.markAsActive(project_id, err => {
const args = this.ProjectModel.updateOne.args[0]
const args = this.ProjectModel.update.args[0]
args[0]._id.should.equal(project_id)
args[1].active.should.equal(true)
return done()