mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Test the invalid-invite page
This commit is contained in:
parent
b33d4e103d
commit
f3a1f32bb1
2 changed files with 23 additions and 2 deletions
|
@ -56,7 +56,7 @@ module.exports = CollaboratorsInviteController =
|
|||
currentUser = req.session.user
|
||||
_renderInvalidPage = () ->
|
||||
logger.log {projectId, token}, "invite not valid, rendering not-valid page"
|
||||
res.render "project/invite/not-valid"
|
||||
res.render "project/invite/not-valid", {title: "Invalid Invite"}
|
||||
# get the target project
|
||||
Project.findOne {_id: projectId}, {owner_ref: 1, name: 1, collaberator_refs: 1, readOnly_refs: 1}, (err, project) ->
|
||||
if err?
|
||||
|
|
|
@ -91,7 +91,28 @@ describe "ProjectInviteTests", ->
|
|||
expect(body).to.match new RegExp("<title>Project Invite - .*</title>")
|
||||
cb()
|
||||
|
||||
# access the project page
|
||||
# forbid access to the project page
|
||||
(cb) =>
|
||||
@user.openProject @invite.projectId, (err) =>
|
||||
expect(err).to.be.instanceof Error
|
||||
cb()
|
||||
|
||||
], done
|
||||
)
|
||||
|
||||
it 'should render the invalid-invite page if the token is invalid', (done) ->
|
||||
Async.series(
|
||||
[
|
||||
# go to the invite page with an invalid token
|
||||
(cb) =>
|
||||
link = @link.replace(@invite.token, 'not_a_real_token')
|
||||
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>Invalid Invite - .*</title>")
|
||||
cb()
|
||||
|
||||
# forbid access to the project page
|
||||
(cb) =>
|
||||
@user.openProject @invite.projectId, (err) =>
|
||||
expect(err).to.be.instanceof Error
|
||||
|
|
Loading…
Reference in a new issue