Merge pull request #3277 from overleaf/revert-3257-jpa-mongoose-latest

Revert "[misc] upgrade mongoose to the latest version"

GitOrigin-RevId: d5957fca68be65a08a687476742ffbb9c3cb86e8
This commit is contained in:
Simon Detheridge
2020-10-12 13:35:50 +01:00
committed by Copybot
parent dba5127856
commit c257b9695a
59 changed files with 655 additions and 445 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()