mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +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
@@ -10,6 +10,7 @@ const MODULE_PATH = path.join(
|
||||
describe('AnalyticsManager', function () {
|
||||
beforeEach(function () {
|
||||
this.fakeUserId = '123abc'
|
||||
this.analyticsId = '123456'
|
||||
this.Settings = {
|
||||
analytics: { enabled: true },
|
||||
}
|
||||
@@ -50,6 +51,9 @@ describe('AnalyticsManager', function () {
|
||||
requires: {
|
||||
'@overleaf/settings': this.Settings,
|
||||
'../../infrastructure/Queues': this.Queues,
|
||||
'./UserAnalyticsIdCache': (this.UserAnalyticsIdCache = {
|
||||
get: sinon.stub().resolves(this.analyticsId),
|
||||
}),
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -70,21 +74,26 @@ describe('AnalyticsManager', function () {
|
||||
|
||||
describe('queues the appropriate message for', function () {
|
||||
it('identifyUser', function () {
|
||||
const oldUserId = '456def'
|
||||
this.AnalyticsManager.identifyUser(this.fakeUserId, oldUserId)
|
||||
const analyticsId = '456def'
|
||||
this.AnalyticsManager.identifyUser(this.fakeUserId, analyticsId)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'identify', {
|
||||
userId: this.fakeUserId,
|
||||
oldUserId,
|
||||
analyticsId,
|
||||
})
|
||||
})
|
||||
|
||||
it('recordEvent', function () {
|
||||
it('recordEventForUser', async function () {
|
||||
const event = 'fake-event'
|
||||
this.AnalyticsManager.recordEvent(this.fakeUserId, event, null)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', {
|
||||
await this.AnalyticsManager.recordEventForUser(
|
||||
this.fakeUserId,
|
||||
event,
|
||||
null
|
||||
)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', {
|
||||
analyticsId: this.analyticsId,
|
||||
event,
|
||||
userId: this.fakeUserId,
|
||||
segmentation: null,
|
||||
isLoggedIn: true,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user