mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Use token in URL to force its precense when invite and allow easy dynamic notifications
This commit is contained in:
+6
-6
@@ -531,14 +531,12 @@ describe "CollaboratorsInviteController", ->
|
||||
beforeEach ->
|
||||
@req.params =
|
||||
Project_id: @project_id
|
||||
invite_id: @invite_id = "thuseoautoh"
|
||||
token: @token = "mock-token"
|
||||
@req.session =
|
||||
user: _id: @current_user_id = "current-user-id"
|
||||
@req.body =
|
||||
token: "thsueothaueotauahsuet"
|
||||
@res.render = sinon.stub()
|
||||
@res.redirect = sinon.stub()
|
||||
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(4, null)
|
||||
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(3, null)
|
||||
@callback = sinon.stub()
|
||||
@next = sinon.stub()
|
||||
|
||||
@@ -552,7 +550,9 @@ describe "CollaboratorsInviteController", ->
|
||||
@res.redirect.calledWith("/project/#{@project_id}").should.equal true
|
||||
|
||||
it 'should have called acceptInvite', ->
|
||||
@CollaboratorsInviteHandler.acceptInvite.callCount.should.equal 1
|
||||
@CollaboratorsInviteHandler.acceptInvite
|
||||
.calledWith(@project_id, @token)
|
||||
.should.equal true
|
||||
|
||||
it 'should have called emitToRoom', ->
|
||||
@EditorRealTimeController.emitToRoom.callCount.should.equal 1
|
||||
@@ -562,7 +562,7 @@ describe "CollaboratorsInviteController", ->
|
||||
|
||||
beforeEach ->
|
||||
@err = new Error('woops')
|
||||
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(4, @err)
|
||||
@CollaboratorsInviteHandler.acceptInvite = sinon.stub().callsArgWith(3, @err)
|
||||
@CollaboratorsInviteController.acceptInvite @req, @res, @next
|
||||
|
||||
it 'should not redirect to project page', ->
|
||||
|
||||
+1
-1
@@ -404,7 +404,7 @@ describe "CollaboratorsInviteHandler", ->
|
||||
@CollaboratorsInviteHandler._tryCancelInviteNotification = sinon.stub().callsArgWith(1, null)
|
||||
@ProjectInvite.remove.callsArgWith(1, null)
|
||||
@call = (callback) =>
|
||||
@CollaboratorsInviteHandler.acceptInvite @projectId, @inviteId, @token, @user, callback
|
||||
@CollaboratorsInviteHandler.acceptInvite @projectId, @token, @user, callback
|
||||
|
||||
afterEach ->
|
||||
@_getInviteByToken.restore()
|
||||
|
||||
Reference in New Issue
Block a user