mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 16:19:02 +02:00
Merge pull request #2724 from overleaf/ns-doc-over-file
allow upload of doc over existing file GitOrigin-RevId: 13578bf4ab6d54686077402488399db0379cc761
This commit is contained in:
@@ -1113,4 +1113,27 @@ describe('ProjectEntityMongoUpdateHandler', function() {
|
||||
this.ProjectMock.verify()
|
||||
})
|
||||
})
|
||||
|
||||
describe('replaceFileWithDoc', function() {
|
||||
it('should simultaneously remove the file and add the doc', async function() {
|
||||
this.ProjectMock.expects('findOneAndUpdate')
|
||||
.withArgs(
|
||||
{ _id: this.project._id },
|
||||
{
|
||||
$pull: { 'rootFolder.0.fileRefs': { _id: this.file._id } },
|
||||
$push: { 'rootFolder.0.docs': this.doc },
|
||||
$inc: { version: 1 }
|
||||
},
|
||||
{ new: true }
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves(this.project)
|
||||
await this.subject.promises.replaceFileWithDoc(
|
||||
this.project._id,
|
||||
this.file._id,
|
||||
this.doc
|
||||
)
|
||||
this.ProjectMock.verify()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user