mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Test when the user does not accept the invite
This commit is contained in:
parent
f33d01f375
commit
b33d4e103d
2 changed files with 24 additions and 1 deletions
|
@ -80,6 +80,26 @@ describe "ProjectInviteTests", ->
|
||||||
@link = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, @invite)
|
@link = CollaboratorsEmailHandler._buildInviteUrl(@fakeProject, @invite)
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
it 'should not grant access if the user does not accept the invite', (done) ->
|
||||||
|
Async.series(
|
||||||
|
[
|
||||||
|
# go to the invite page
|
||||||
|
(cb) =>
|
||||||
|
followInviteLink @user, @link, (err, response, body) =>
|
||||||
|
expect(err).to.be.oneOf [null, undefined]
|
||||||
|
expect(response.statusCode).to.equal 200
|
||||||
|
expect(body).to.match new RegExp("<title>Project Invite - .*</title>")
|
||||||
|
cb()
|
||||||
|
|
||||||
|
# access the project page
|
||||||
|
(cb) =>
|
||||||
|
@user.openProject @invite.projectId, (err) =>
|
||||||
|
expect(err).to.be.instanceof Error
|
||||||
|
cb()
|
||||||
|
|
||||||
|
], done
|
||||||
|
)
|
||||||
|
|
||||||
it 'should allow the user to accept the invite and access the project', (done) ->
|
it 'should allow the user to accept the invite and access the project', (done) ->
|
||||||
Async.series(
|
Async.series(
|
||||||
[
|
[
|
||||||
|
|
|
@ -73,7 +73,10 @@ class User
|
||||||
@request.get {
|
@request.get {
|
||||||
url: "/project/#{project_id}"
|
url: "/project/#{project_id}"
|
||||||
}, (error, response, body) ->
|
}, (error, response, body) ->
|
||||||
return callback(error) if error? or response.statusCode != 200
|
return callback(error) if error?
|
||||||
|
if response.statusCode != 200
|
||||||
|
err = new Error("Non-success response when opening project: #{response.statusCode}")
|
||||||
|
return callback(err)
|
||||||
callback(null)
|
callback(null)
|
||||||
|
|
||||||
addUserToProject: (project_id, email, privileges, callback = (error, user) ->) ->
|
addUserToProject: (project_id, email, privileges, callback = (error, user) ->) ->
|
||||||
|
|
Loading…
Reference in a new issue