mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-28 03:21:56 +02:00
Merge pull request #2639 from overleaf/em-convert-doc-to-file
Endpoint for converting a doc to a file GitOrigin-RevId: 0a3bd46a7a78537b0f64dc577402277cbe81fecb
This commit is contained in:
@@ -1089,4 +1089,27 @@ describe('ProjectEntityMongoUpdateHandler', function() {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('replaceDocWithFile', function() {
|
||||
it('should simultaneously remove the doc and add the file', async function() {
|
||||
this.ProjectMock.expects('findOneAndUpdate')
|
||||
.withArgs(
|
||||
{ _id: this.project._id },
|
||||
{
|
||||
$pull: { 'rootFolder.0.docs': { _id: this.doc._id } },
|
||||
$push: { 'rootFolder.0.fileRefs': this.file },
|
||||
$inc: { version: 1 }
|
||||
},
|
||||
{ new: true }
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves(this.project)
|
||||
await this.subject.promises.replaceDocWithFile(
|
||||
this.project._id,
|
||||
this.doc._id,
|
||||
this.file
|
||||
)
|
||||
this.ProjectMock.verify()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user