Merge pull request #3257 from overleaf/jpa-mongoose-latest
[misc] upgrade mongoose to the latest version GitOrigin-RevId: cc612312e1661a92907dd8d42a32aeccb8cdb62d
This commit is contained in:
committed by
Copybot
parent
e01f9109c6
commit
dba5127856
@@ -49,7 +49,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
describe('initializeCollabratecProject', function() {
|
||||
describe('when update succeeds', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields()
|
||||
this.ProjectModel.updateOne = sinon.stub().yields()
|
||||
return this.ProjectCollabratecDetailsHandler.initializeCollabratecProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -71,7 +71,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
]
|
||||
}
|
||||
}
|
||||
return expect(this.ProjectModel.update).to.have.been.calledWith(
|
||||
return expect(this.ProjectModel.updateOne).to.have.been.calledWith(
|
||||
{ _id: this.projectId },
|
||||
update,
|
||||
this.callback
|
||||
@@ -81,7 +81,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update has error', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields('error')
|
||||
this.ProjectModel.updateOne = sinon.stub().yields('error')
|
||||
return this.ProjectCollabratecDetailsHandler.initializeCollabratecProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -98,7 +98,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid args', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.initializeCollabratecProject(
|
||||
'bad-project-id',
|
||||
'bad-user-id',
|
||||
@@ -109,7 +109,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -206,7 +206,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
describe('linkCollabratecUserProject', function() {
|
||||
describe('when update succeeds', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields()
|
||||
this.ProjectModel.updateOne = sinon.stub().yields()
|
||||
return this.ProjectCollabratecDetailsHandler.linkCollabratecUserProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -235,7 +235,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return expect(this.ProjectModel.update).to.have.been.calledWith(
|
||||
return expect(this.ProjectModel.updateOne).to.have.been.calledWith(
|
||||
query,
|
||||
update,
|
||||
this.callback
|
||||
@@ -245,7 +245,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update has error', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields('error')
|
||||
this.ProjectModel.updateOne = sinon.stub().yields('error')
|
||||
return this.ProjectCollabratecDetailsHandler.linkCollabratecUserProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -261,7 +261,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid args', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.linkCollabratecUserProject(
|
||||
'bad-project-id',
|
||||
'bad-user-id',
|
||||
@@ -271,7 +271,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -298,7 +298,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update succeeds', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields()
|
||||
this.ProjectModel.updateOne = sinon.stub().yields()
|
||||
return this.ProjectCollabratecDetailsHandler.setCollabratecUsers(
|
||||
this.projectId,
|
||||
this.collabratecUsers,
|
||||
@@ -312,7 +312,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
collabratecUsers: this.collabratecUsers
|
||||
}
|
||||
}
|
||||
return expect(this.ProjectModel.update).to.have.been.calledWith(
|
||||
return expect(this.ProjectModel.updateOne).to.have.been.calledWith(
|
||||
{ _id: this.projectId },
|
||||
update,
|
||||
this.callback
|
||||
@@ -322,7 +322,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update has error', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields('error')
|
||||
this.ProjectModel.updateOne = sinon.stub().yields('error')
|
||||
return this.ProjectCollabratecDetailsHandler.setCollabratecUsers(
|
||||
this.projectId,
|
||||
this.collabratecUsers,
|
||||
@@ -337,7 +337,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid project_id', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.setCollabratecUsers(
|
||||
'bad-project-id',
|
||||
this.collabratecUsers,
|
||||
@@ -346,7 +346,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -357,7 +357,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
describe('with invalid user_id', function() {
|
||||
beforeEach(function() {
|
||||
this.collabratecUsers[1].user_id = 'bad-user-id'
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.setCollabratecUsers(
|
||||
this.projectId,
|
||||
this.collabratecUsers,
|
||||
@@ -366,7 +366,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -378,7 +378,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
describe('unlinkCollabratecUserProject', function() {
|
||||
describe('when update succeeds', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields()
|
||||
this.ProjectModel.updateOne = sinon.stub().yields()
|
||||
return this.ProjectCollabratecDetailsHandler.unlinkCollabratecUserProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -395,7 +395,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
}
|
||||
}
|
||||
}
|
||||
return expect(this.ProjectModel.update).to.have.been.calledWith(
|
||||
return expect(this.ProjectModel.updateOne).to.have.been.calledWith(
|
||||
query,
|
||||
update,
|
||||
this.callback
|
||||
@@ -405,7 +405,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update has error', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields('error')
|
||||
this.ProjectModel.updateOne = sinon.stub().yields('error')
|
||||
return this.ProjectCollabratecDetailsHandler.unlinkCollabratecUserProject(
|
||||
this.projectId,
|
||||
this.userId,
|
||||
@@ -420,7 +420,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid args', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.unlinkCollabratecUserProject(
|
||||
'bad-project-id',
|
||||
'bad-user-id',
|
||||
@@ -429,7 +429,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -441,7 +441,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
describe('updateCollabratecUserIds', function() {
|
||||
describe('when update succeeds', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields()
|
||||
this.ProjectModel.updateMany = sinon.stub().yields()
|
||||
return this.ProjectCollabratecDetailsHandler.updateCollabratecUserIds(
|
||||
this.userId,
|
||||
this.userId2,
|
||||
@@ -450,10 +450,9 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should update project model', function() {
|
||||
return expect(this.ProjectModel.update).to.have.been.calledWith(
|
||||
return expect(this.ProjectModel.updateMany).to.have.been.calledWith(
|
||||
{ 'collabratecUsers.user_id': this.userId },
|
||||
{ $set: { 'collabratecUsers.$.user_id': this.userId2 } },
|
||||
{ multi: true },
|
||||
this.callback
|
||||
)
|
||||
})
|
||||
@@ -461,7 +460,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('when update has error', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub().yields('error')
|
||||
this.ProjectModel.updateMany = sinon.stub().yields('error')
|
||||
return this.ProjectCollabratecDetailsHandler.updateCollabratecUserIds(
|
||||
this.userId,
|
||||
this.userId2,
|
||||
@@ -476,7 +475,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid old_user_id', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.updateCollabratecUserIds(
|
||||
'bad-user-id',
|
||||
this.userId2,
|
||||
@@ -485,7 +484,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
@@ -495,7 +494,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
|
||||
describe('with invalid new_user_id', function() {
|
||||
beforeEach(function() {
|
||||
this.ProjectModel.update = sinon.stub()
|
||||
this.ProjectModel.updateOne = sinon.stub()
|
||||
return this.ProjectCollabratecDetailsHandler.updateCollabratecUserIds(
|
||||
this.userId,
|
||||
'bad-user-id',
|
||||
@@ -504,7 +503,7 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
||||
})
|
||||
|
||||
it('should not update', function() {
|
||||
return expect(this.ProjectModel.update).not.to.have.been.called
|
||||
return expect(this.ProjectModel.updateOne).not.to.have.been.called
|
||||
})
|
||||
|
||||
it('should callback with error', function() {
|
||||
|
||||
Reference in New Issue
Block a user