mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
destroy session when getting project details
This commit is contained in:
parent
6f9969d6e1
commit
de38cbf595
2 changed files with 15 additions and 4 deletions
|
@ -10,4 +10,6 @@ module.exports =
|
|||
if err?
|
||||
logger.log err:err, project_id:project_id, "something went wrong getting project details"
|
||||
return res.send 500
|
||||
res.json(projDetails)
|
||||
req.session.destroy()
|
||||
res.json(projDetails)
|
||||
|
||||
|
|
|
@ -17,17 +17,19 @@ describe 'Project api controller', ->
|
|||
@req =
|
||||
params:
|
||||
project_id:@project_id
|
||||
session:
|
||||
destroy:sinon.stub()
|
||||
@res = {}
|
||||
@projDetails = {name:"something"}
|
||||
|
||||
|
||||
describe "getProjectDetails", ->
|
||||
|
||||
it "should ask the project details handler for proj details", (done)->
|
||||
projDetails = {name:"something"}
|
||||
@ProjectDetailsHandler.getDetails.callsArgWith(1, null, projDetails)
|
||||
@ProjectDetailsHandler.getDetails.callsArgWith(1, null, @projDetails)
|
||||
@res.json = (data)=>
|
||||
@ProjectDetailsHandler.getDetails.calledWith(@project_id).should.equal true
|
||||
data.should.deep.equal projDetails
|
||||
data.should.deep.equal @projDetails
|
||||
done()
|
||||
@controller.getProjectDetails @req, @res
|
||||
|
||||
|
@ -37,4 +39,11 @@ describe 'Project api controller', ->
|
|||
@res.send = (resCode)=>
|
||||
resCode.should.equal 500
|
||||
done()
|
||||
@controller.getProjectDetails @req, @res
|
||||
|
||||
it "should destroy the session", (done)->
|
||||
@ProjectDetailsHandler.getDetails.callsArgWith(1, null, @projDetails)
|
||||
@res.json = (data)=>
|
||||
@req.session.destroy.called.should.equal true
|
||||
done()
|
||||
@controller.getProjectDetails @req, @res
|
Loading…
Reference in a new issue