version ProjectEntityHandler.copyFileFromExistingProjectWithProject

This commit is contained in:
Hayden Faulds
2017-12-04 09:42:09 +00:00
parent 60ee78704a
commit 088ce33cbc
2 changed files with 33 additions and 13 deletions
@@ -20,7 +20,7 @@ describe 'ProjectEntityHandler', ->
@fileUrl = 'filestore.example.com/file'
@FileStoreHandler =
uploadFileFromDisk: sinon.stub().callsArgWith(3, null, @fileUrl)
copyFile: sinon.stub().callsArgWith(4, null)
copyFile: sinon.stub().callsArgWith(4, null, @fileUrl)
@tpdsUpdateSender =
addDoc:sinon.stub().callsArg(1)
addFile:sinon.stub().callsArg(1)
@@ -570,9 +570,9 @@ describe 'ProjectEntityHandler', ->
@ProjectEntityHandler.addFile project_id, folder_id, fileName, {}, userId, (err, fileRef, parentFolder)->
it "should should send the change in project structure to the doc updater", (done) ->
@documentUpdaterHandler.updateProjectStructure = (project_id, user_id, oldDocs, newDocs, oldFiles, newFiles) =>
project_id.should.equal project_id
user_id.should.equal user_id
@documentUpdaterHandler.updateProjectStructure = (passed_project_id, passed_user_id, oldDocs, newDocs, oldFiles, newFiles) =>
passed_project_id.should.equal project_id
passed_user_id.should.equal userId
newFiles.length.should.equal 1
newFile = newFiles[0]
newFile.file.name.should.equal fileName
@@ -989,7 +989,8 @@ describe 'ProjectEntityHandler', ->
oldFileRef = {name:fileName, _id:"oldFileRef"}
beforeEach ->
@ProjectEntityHandler._putElement = sinon.stub().callsArgWith(4, null, {path:{fileSystem:"somehintg"}})
@fileSystemPath = "somehintg"
@ProjectEntityHandler._putElement = sinon.stub().callsArgWith(4, null, {path:{fileSystem: @fileSystemPath}})
it 'should copy the file in FileStoreHandler', (done)->
@ProjectEntityHandler._putElement = sinon.stub().callsArgWith(4, null, {path:{fileSystem:"somehintg"}})
@@ -1030,6 +1031,19 @@ describe 'ProjectEntityHandler', ->
@ProjectEntityHandler.copyFileFromExistingProjectWithProject @project, folder_id, oldProject_id, oldFileRef, (err, fileRef, parentFolder)->
it "should should send the change in project structure to the doc updater", (done) ->
@documentUpdaterHandler.updateProjectStructure = (passed_project_id, passed_user_id, oldDocs, newDocs, oldFiles, newFiles) =>
passed_project_id.should.equal project_id
#passed_user_id.should.equal userId
newFiles.length.should.equal 1
newFile = newFiles[0]
newFile.file.name.should.equal fileName
newFile.path.should.equal @fileSystemPath
newFile.url.should.equal @fileUrl
done()
@ProjectEntityHandler.copyFileFromExistingProjectWithProject @project, folder_id, oldProject_id, oldFileRef, (err, fileRef, parentFolder)->
describe "renameEntity", ->
beforeEach ->
@entity_id = "4eecaffcbffa66588e000009"