mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-09 00:59:02 +02:00
Merge pull request #4989 from overleaf/jk-de-ng-logout
[web] de-ng logout page GitOrigin-RevId: 0d46e554ab41759bbf1044fcd49d750322a345ae
This commit is contained in:
@@ -33,6 +33,7 @@ describe('UserController', function () {
|
||||
},
|
||||
ip: '0:0:0:0',
|
||||
query: {},
|
||||
headers: {},
|
||||
}
|
||||
|
||||
this.UserDeleter = { deleteUser: sinon.stub().yields() }
|
||||
@@ -91,6 +92,7 @@ describe('UserController', function () {
|
||||
.withArgs('https://evil.com')
|
||||
.returns(undefined)
|
||||
this.UrlHelper.getSafeRedirectPath.returnsArg(0)
|
||||
this.acceptsJson = sinon.stub().returns(false)
|
||||
|
||||
this.UserController = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
@@ -127,6 +129,9 @@ describe('UserController', function () {
|
||||
sendEmail: sinon.stub(),
|
||||
promises: { sendEmail: sinon.stub().resolves() },
|
||||
}),
|
||||
'../../infrastructure/RequestContentTypeDetection': {
|
||||
acceptsJson: this.acceptsJson,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -480,6 +485,10 @@ describe('UserController', function () {
|
||||
})
|
||||
|
||||
describe('logout', function () {
|
||||
beforeEach(function () {
|
||||
this.acceptsJson.returns(false)
|
||||
})
|
||||
|
||||
it('should destroy the session', function (done) {
|
||||
this.req.session.destroy = sinon.stub().callsArgWith(0)
|
||||
this.res.redirect = url => {
|
||||
@@ -533,6 +542,20 @@ describe('UserController', function () {
|
||||
}
|
||||
this.UserController.logout(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should send json with redir property for json request', function (done) {
|
||||
this.acceptsJson.returns(true)
|
||||
this.req.session.destroy = sinon.stub().callsArgWith(0)
|
||||
this.res.status = code => {
|
||||
code.should.equal(200)
|
||||
return this.res
|
||||
}
|
||||
this.res.json = data => {
|
||||
data.redir.should.equal('/login')
|
||||
done()
|
||||
}
|
||||
this.UserController.logout(this.req, this.res)
|
||||
})
|
||||
})
|
||||
|
||||
describe('register', function () {
|
||||
|
||||
Reference in New Issue
Block a user