Fix unit tests

This commit is contained in:
Shane Kilkelly 2016-11-08 16:00:18 +00:00
parent bfa0e7cf89
commit a373868862
2 changed files with 5 additions and 5 deletions

View file

@ -92,7 +92,7 @@ describe "AuthenticationController", ->
@req.login = sinon.stub().callsArgWith(1, null)
@res.json = sinon.stub()
@req.session = @session = {passport: {user: @user}}
@req.session.destroy = sinon.stub()
@req.session.destroy = sinon.stub().callsArgWith(0, null)
@req.session.save = sinon.stub().callsArgWith(0, null)
@req.sessionStore = {generate: sinon.stub()}
@passport.authenticate.callsArgWith(1, null, @user, @info)
@ -164,7 +164,7 @@ describe "AuthenticationController", ->
@req.session = @session = {passport: {user: @user}}
@req.session =
passport: {user: {_id: "one"}}
@req.session.destroy = sinon.stub()
@req.session.destroy = sinon.stub().callsArgWith(0, null)
@req.session.save = sinon.stub().callsArgWith(0, null)
@req.sessionStore = {generate: sinon.stub()}
@UserSessionsManager.trackSession = sinon.stub()

View file

@ -33,7 +33,7 @@ describe 'UserSessionsManager', ->
@rclient.exec.callsArgWith(0, null)
@redis =
createClient: () => @rclient
client: () => @rclient
@logger =
err: sinon.stub()
error: sinon.stub()
@ -42,15 +42,15 @@ describe 'UserSessionsManager', ->
redis:
web: {}
@UserSessionsManager = SandboxedModule.require modulePath, requires:
"redis-sharelatex": @redis
"logger-sharelatex": @logger
"settings-sharelatex": @settings
'./UserSessionsRedis': @redis
describe '_sessionSetKey', ->
it 'should build the correct key', ->
result = @UserSessionsManager._sessionSetKey(@user)
result.should.equal 'UserSessions:abcd'
result.should.equal 'UserSessions:{abcd}'
describe '_sessionKey', ->