mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
Merge pull request #3653 from overleaf/jpa-merge-deleted-docs-sources
[EditorHttpController] fetch deletedDocs from docstore, merge w/ project GitOrigin-RevId: 5cf46aa7ded034285051ddae21b5c80d8c806693
This commit is contained in:
@@ -106,6 +106,9 @@ describe('ProjectEditorHandler', function() {
|
||||
token: 'my-secret-token2'
|
||||
}
|
||||
]
|
||||
this.deletedDocsFromDocstore = [
|
||||
{ _id: 'deleted-doc-id-from-docstore', name: 'docstore.tex' }
|
||||
]
|
||||
return (this.handler = SandboxedModule.require(modulePath))
|
||||
})
|
||||
|
||||
@@ -115,7 +118,8 @@ describe('ProjectEditorHandler', function() {
|
||||
return (this.result = this.handler.buildProjectModelView(
|
||||
this.project,
|
||||
this.members,
|
||||
this.invites
|
||||
this.invites,
|
||||
this.deletedDocsFromDocstore
|
||||
))
|
||||
})
|
||||
|
||||
@@ -155,7 +159,8 @@ describe('ProjectEditorHandler', function() {
|
||||
// omit deletedAt field
|
||||
_id: this.project.deletedDocs[0]._id,
|
||||
name: this.project.deletedDocs[0].name
|
||||
}
|
||||
},
|
||||
this.deletedDocsFromDocstore[0]
|
||||
])
|
||||
})
|
||||
|
||||
@@ -235,6 +240,26 @@ describe('ProjectEditorHandler', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when docstore sends a deleted doc that is also present in the project', function() {
|
||||
beforeEach(function() {
|
||||
this.deletedDocsFromDocstore.push(this.project.deletedDocs[0])
|
||||
this.result = this.handler.buildProjectModelView(
|
||||
this.project,
|
||||
this.members,
|
||||
this.invites,
|
||||
this.deletedDocsFromDocstore
|
||||
)
|
||||
})
|
||||
|
||||
it('should not send any duplicate', function() {
|
||||
should.exist(this.result.deletedDocs)
|
||||
this.result.deletedDocs.should.deep.equal([
|
||||
this.project.deletedDocs[0],
|
||||
this.deletedDocsFromDocstore[0]
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe('deletedByExternalDataSource', function() {
|
||||
it('should set the deletedByExternalDataSource flag to false when it is not there', function() {
|
||||
delete this.project.deletedByExternalDataSource
|
||||
|
||||
Reference in New Issue
Block a user