mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Test clicking the invite after already accepting
This commit is contained in:
parent
9c530e1bb6
commit
545ce79c71
1 changed files with 28 additions and 1 deletions
|
@ -91,12 +91,21 @@ expectInvalidInvitePage = (user, link, callback=()->) ->
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
expectInviteRedirectToRegister = (user, link, callback=()->) ->
|
expectInviteRedirectToRegister = (user, link, callback=()->) ->
|
||||||
|
# view invite, redirect to `/register`
|
||||||
tryFollowInviteLink user, link, (err, response, body) ->
|
tryFollowInviteLink user, link, (err, response, body) ->
|
||||||
expect(err).to.be.oneOf [null, undefined]
|
expect(err).to.be.oneOf [null, undefined]
|
||||||
expect(response.statusCode).to.equal 302
|
expect(response.statusCode).to.equal 302
|
||||||
expect(response.headers.location).to.match new RegExp("^/register\?.*redir=.*$")
|
expect(response.headers.location).to.match new RegExp("^/register\?.*redir=.*$")
|
||||||
callback()
|
callback()
|
||||||
|
|
||||||
|
expectInviteRedirectToProject = (user, link, invite, callback=()->) ->
|
||||||
|
# view invite, redirect straight to project
|
||||||
|
tryFollowInviteLink user, link, (err, response, body) ->
|
||||||
|
expect(err).to.be.oneOf [null, undefined]
|
||||||
|
expect(response.statusCode).to.equal 302
|
||||||
|
expect(response.headers.location).to.equal "/project/#{invite.projectId}"
|
||||||
|
callback()
|
||||||
|
|
||||||
expectAcceptInviteAndRedirect = (user, invite, callback=()->) ->
|
expectAcceptInviteAndRedirect = (user, invite, callback=()->) ->
|
||||||
# should accept the invite and redirect to project
|
# should accept the invite and redirect to project
|
||||||
tryAcceptInvite user, invite, (err, response, body) =>
|
tryAcceptInvite user, invite, (err, response, body) =>
|
||||||
|
@ -152,7 +161,25 @@ describe "ProjectInviteTests", ->
|
||||||
(cb) => revokeInvite(@sendingUser, @projectId, @invite._id, cb)
|
(cb) => revokeInvite(@sendingUser, @projectId, @invite._id, cb)
|
||||||
], done
|
], done
|
||||||
|
|
||||||
# describe 'user is already a member of the project', ->
|
describe 'user is already a member of the project', ->
|
||||||
|
|
||||||
|
beforeEach (done) ->
|
||||||
|
Async.series [
|
||||||
|
(cb) =>
|
||||||
|
expectInvitePage @user, @link, cb
|
||||||
|
(cb) =>
|
||||||
|
expectAcceptInviteAndRedirect @user, @invite, cb
|
||||||
|
], done
|
||||||
|
|
||||||
|
describe 'when user clicks on the invite a second time', ->
|
||||||
|
|
||||||
|
it 'should just redirect to the project page', (done) ->
|
||||||
|
Async.series [
|
||||||
|
(cb) =>
|
||||||
|
expectProjectAccess @user, @invite.projectId, cb
|
||||||
|
(cb) =>
|
||||||
|
expectInviteRedirectToProject @user, @link, @invite, cb
|
||||||
|
], done
|
||||||
|
|
||||||
describe 'user is not a member of the project', ->
|
describe 'user is not a member of the project', ->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue