mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 13:21:37 +02:00
Merge pull request #4639 from overleaf/ab-web-mono-analytics-id
Analytics ID support GitOrigin-RevId: 820a6c0f4d19f046f6c791ce4dc64dbc80748924
This commit is contained in:
committed by
Copybot
parent
3af8fc63de
commit
44a8883b6d
@@ -12,7 +12,7 @@ describe('AnalyticsController', function () {
|
||||
|
||||
this.AnalyticsManager = {
|
||||
updateEditingSession: sinon.stub(),
|
||||
recordEvent: sinon.stub(),
|
||||
recordEventForSession: sinon.stub(),
|
||||
}
|
||||
|
||||
this.Features = {
|
||||
@@ -42,6 +42,7 @@ describe('AnalyticsController', function () {
|
||||
params: {
|
||||
projectId: 'a project id',
|
||||
},
|
||||
session: {},
|
||||
}
|
||||
this.GeoIpLookup.getDetails = sinon
|
||||
.stub()
|
||||
@@ -78,35 +79,18 @@ describe('AnalyticsController', function () {
|
||||
delete this.expectedData._csrf
|
||||
})
|
||||
|
||||
it('should use the user_id', function (done) {
|
||||
this.SessionManager.getLoggedInUserId.returns('1234')
|
||||
it('should use the session', function (done) {
|
||||
this.controller.recordEvent(this.req, this.res)
|
||||
this.AnalyticsManager.recordEvent
|
||||
.calledWith('1234', this.req.params.event, this.expectedData)
|
||||
.should.equal(true)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should use the session id', function (done) {
|
||||
this.controller.recordEvent(this.req, this.res)
|
||||
this.AnalyticsManager.recordEvent
|
||||
.calledWith(
|
||||
this.req.sessionID,
|
||||
this.req.params.event,
|
||||
this.expectedData
|
||||
)
|
||||
this.AnalyticsManager.recordEventForSession
|
||||
.calledWith(this.req.session, this.req.params.event, this.expectedData)
|
||||
.should.equal(true)
|
||||
done()
|
||||
})
|
||||
|
||||
it('should remove the CSRF token before sending to the manager', function (done) {
|
||||
this.controller.recordEvent(this.req, this.res)
|
||||
this.AnalyticsManager.recordEvent
|
||||
.calledWith(
|
||||
this.req.sessionID,
|
||||
this.req.params.event,
|
||||
this.expectedData
|
||||
)
|
||||
this.AnalyticsManager.recordEventForSession
|
||||
.calledWith(this.req.session, this.req.params.event, this.expectedData)
|
||||
.should.equal(true)
|
||||
done()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user