Merge pull request #9074 from overleaf/jel-saml-log-tests
[web] Add tests for SAML log GitOrigin-RevId: 7bc5b25461063b32d3471b7f4ab966f2caa4e70c
This commit is contained in:
@@ -31,13 +31,24 @@ describe('SamlLogHandler', function () {
|
||||
|
||||
describe('with valid data object', function () {
|
||||
beforeEach(function () {
|
||||
SamlLogHandler.log(providerId, sessionId, data)
|
||||
SamlLogHandler.log(
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
},
|
||||
data
|
||||
)
|
||||
})
|
||||
|
||||
it('should log data', function () {
|
||||
samlLog.providerId.should.equal(providerId)
|
||||
samlLog.sessionId.should.equal(sessionId.substr(0, 8))
|
||||
samlLog.jsonData.should.equal('{"foo":true}')
|
||||
samlLog.jsonData.should.equal(
|
||||
JSON.stringify({
|
||||
foo: true,
|
||||
samlSession: { universityId: 'provider-id' },
|
||||
})
|
||||
)
|
||||
expect(samlLog.data).to.be.undefined
|
||||
samlLog.save.should.have.been.calledOnce
|
||||
})
|
||||
@@ -48,7 +59,13 @@ describe('SamlLogHandler', function () {
|
||||
const circularRef = {}
|
||||
circularRef.circularRef = circularRef
|
||||
|
||||
SamlLogHandler.log(providerId, sessionId, circularRef)
|
||||
SamlLogHandler.log(
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
},
|
||||
circularRef
|
||||
)
|
||||
})
|
||||
|
||||
it('should log without data and log error', function () {
|
||||
@@ -68,7 +85,13 @@ describe('SamlLogHandler', function () {
|
||||
beforeEach(function () {
|
||||
samlLog.save = sinon.stub().yields('error')
|
||||
|
||||
SamlLogHandler.log(providerId, sessionId, data)
|
||||
SamlLogHandler.log(
|
||||
{
|
||||
session: { saml: { universityId: providerId } },
|
||||
sessionID: sessionId,
|
||||
},
|
||||
data
|
||||
)
|
||||
})
|
||||
|
||||
it('should log error', function () {
|
||||
|
||||
Reference in New Issue
Block a user