pass user_id into EditorController.replaceFile

This commit is contained in:
Hayden Faulds
2017-12-04 09:42:09 +00:00
parent 08891c7a7f
commit feee582368
6 changed files with 10 additions and 10 deletions
@@ -254,8 +254,8 @@ describe "EditorController", ->
it 'should send the replace file message to the editor controller', (done)->
@ProjectEntityHandler.replaceFile = sinon.stub().callsArgWith(4)
@EditorController.replaceFile @project_id, @file_id, @fsPath, @source, =>
@ProjectEntityHandler.replaceFile.calledWith(@project_id, @file_id, @fsPath).should.equal true
@EditorController.replaceFile @project_id, @file_id, @fsPath, @source, @user_id, =>
@ProjectEntityHandler.replaceFile.calledWith(@project_id, @file_id, @fsPath, @user_id).should.equal true
done()
describe 'addFolderWithoutLock :', ->
@@ -115,7 +115,7 @@ describe 'UpdateMerger :', ->
@fileName = "file.png"
@fsPath = "fs/path.tex"
@editorController.addFile = sinon.stub().callsArg(6)
@editorController.replaceFile = sinon.stub().callsArg(4)
@editorController.replaceFile = sinon.stub().callsArg(5)
@editorController.deleteEntity = sinon.stub()
@editorController.mkdirp = sinon.stub().withArgs(@project_id).callsArgWith(2, null, [@folder], @folder)
@updateMerger.p.writeStreamToDisk = sinon.stub().withArgs(@project_id, @file_id, @update).callsArgWith(3, null, @fsPath)
@@ -123,7 +123,7 @@ describe 'UpdateMerger :', ->
it 'should replace file if the file already exists', (done)->
@updateMerger.p.processFile @project_id, @file_id, @fsPath, @path, @source, @user_id, =>
@editorController.addFile.called.should.equal false
@editorController.replaceFile.calledWith(@project_id, @file_id, @fsPath, @source).should.equal true
@editorController.replaceFile.calledWith(@project_id, @file_id, @fsPath, @source, @user_id).should.equal true
done()
it 'should call add file if the file does not exist', (done)->
@@ -169,7 +169,7 @@ describe "FileSystemImportManager", ->
}
@FileSystemImportManager._isSafeOnFileSystem = sinon.stub().callsArgWith(1, null, true)
@ProjectLocator.findElement = sinon.stub().callsArgWith(1, null, @folder)
@EditorController.replaceFile = sinon.stub().callsArg(4)
@EditorController.replaceFile = sinon.stub().callsArg(5)
@FileSystemImportManager.addFile @user_id, @project_id, @folder_id, @name, @path_on_disk, true, @callback
it "should look up the folder", ->
@@ -178,7 +178,7 @@ describe "FileSystemImportManager", ->
.should.equal true
it "should replace the file", ->
@EditorController.replaceFile.calledWith(@project_id, @file_id, @path_on_disk, "upload")
@EditorController.replaceFile.calledWith(@project_id, @file_id, @path_on_disk, "upload", @user_id)
.should.equal true
describe "addFolder", ->