Merge pull request #2849 from overleaf/em-convert-file-to-doc

Fix update order when converting a file to a doc

GitOrigin-RevId: a0c9488e3870cc972c21b40ff0e2577fcec40ee0
This commit is contained in:
Eric Mc Sween
2020-05-20 10:14:49 -04:00
committed by Copybot
parent f5b2640c82
commit 8ba63b0f8e
6 changed files with 600 additions and 636 deletions

View File

@@ -880,10 +880,17 @@ describe('ProjectEntityUpdateHandler', function() {
this.folder = { _id: folderId, docs: [], fileRefs: [this.existingFile] }
this.newDoc = { _id: docId }
this.docLines = ['line one', 'line two']
this.path = 'path/to/file'
this.ProjectLocator.findElement.yields(null, this.folder, {
fileSystem: this.path
})
this.folderPath = '/path/to/folder'
this.filePath = '/path/to/folder/foo.tex'
this.ProjectLocator.findElement
.withArgs({
project_id: projectId,
element_id: this.folder._id,
type: 'folder'
})
.yields(null, this.folder, {
fileSystem: this.folderPath
})
this.DocstoreManager.updateDoc.yields()
this.ProjectEntityMongoUpdateHandler.replaceFileWithDoc.yields(
null,
@@ -924,7 +931,7 @@ describe('ProjectEntityUpdateHandler', function() {
expect(this.TpdsUpdateSender.addDoc).to.have.been.calledWith({
project_id: projectId,
doc_id: this.newDoc._id,
path: this.path,
path: this.filePath,
project_name: this.newProject.name,
rev: this.existingFile.rev + 1
})
@@ -934,13 +941,13 @@ describe('ProjectEntityUpdateHandler', function() {
const oldFiles = [
{
file: this.existingFile,
path: `${this.path}/foo.tex`
path: this.filePath
}
]
const newDocs = [
{
doc: sinon.match(this.newDoc),
path: this.path,
path: this.filePath,
docLines: this.docLines.join('\n')
}
]