|
|
@@ -382,11 +382,13 @@ describe "EditorController", ->
|
|
|
beforeEach ->
|
|
|
@LockManager.getLock.callsArgWith(1)
|
|
|
@LockManager.releaseLock.callsArgWith(1)
|
|
|
- @EditorController.deleteEntityWithoutLock = sinon.stub().callsArgWith(4)
|
|
|
+ @EditorController.deleteEntityWithoutLock = sinon.stub().callsArgWith(5)
|
|
|
|
|
|
it "should call deleteEntityWithoutLock", (done)->
|
|
|
@EditorController.deleteEntity @project_id, @entity_id, @type, @source, =>
|
|
|
- @EditorController.deleteEntityWithoutLock.calledWith(@project_id, @entity_id, @type, @source).should.equal true
|
|
|
+ @EditorController.deleteEntityWithoutLock
|
|
|
+ .calledWith(@project_id, @entity_id, @type, @source, null)
|
|
|
+ .should.equal true
|
|
|
done()
|
|
|
|
|
|
it "should take the lock", (done)->
|
|
|
@@ -404,30 +406,25 @@ describe "EditorController", ->
|
|
|
@EditorController.deleteEntity @project_id, @entity_id, @type, @source, (err)=>
|
|
|
expect(err).to.exist
|
|
|
err.should.equal "timed out"
|
|
|
- done()
|
|
|
-
|
|
|
-
|
|
|
+ done()
|
|
|
|
|
|
describe 'deleteEntityWithoutLock', ->
|
|
|
- beforeEach ->
|
|
|
- @ProjectEntityHandler.deleteEntity = (project_id, entity_id, type, callback)-> callback()
|
|
|
+ beforeEach (done) ->
|
|
|
@entity_id = "entity_id_here"
|
|
|
@type = "doc"
|
|
|
@EditorRealTimeController.emitToRoom = sinon.stub()
|
|
|
-
|
|
|
- it 'should delete the folder using the project entity handler', (done)->
|
|
|
- mock = sinon.mock(@ProjectEntityHandler).expects("deleteEntity").withArgs(@project_id, @entity_id, @type).callsArg(3)
|
|
|
-
|
|
|
- @EditorController.deleteEntityWithoutLock @project_id, @entity_id, @type, @source, ->
|
|
|
- mock.verify()
|
|
|
- done()
|
|
|
-
|
|
|
- it 'notify users an entity has been deleted', (done)->
|
|
|
- @EditorController.deleteEntityWithoutLock @project_id, @entity_id, @type, @source, =>
|
|
|
- @EditorRealTimeController.emitToRoom
|
|
|
- .calledWith(@project_id, "removeEntity", @entity_id, @source)
|
|
|
- .should.equal true
|
|
|
- done()
|
|
|
+ @ProjectEntityHandler.deleteEntity = sinon.stub().callsArg(4)
|
|
|
+ @EditorController.deleteEntityWithoutLock @project_id, @entity_id, @type, @source, @user_id, done
|
|
|
+
|
|
|
+ it 'should delete the folder using the project entity handler', ->
|
|
|
+ @ProjectEntityHandler.deleteEntity
|
|
|
+ .calledWith(@project_id, @entity_id, @type, @user_id)
|
|
|
+ .should.equal.true
|
|
|
+
|
|
|
+ it 'notify users an entity has been deleted', ->
|
|
|
+ @EditorRealTimeController.emitToRoom
|
|
|
+ .calledWith(@project_id, "removeEntity", @entity_id, @source)
|
|
|
+ .should.equal true
|
|
|
|
|
|
describe "getting a list of project paths", ->
|
|
|
|