mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -6,8 +6,8 @@ const modulePath = path.join(
|
||||
)
|
||||
const sinon = require('sinon')
|
||||
|
||||
describe('AnalyticsController', function() {
|
||||
beforeEach(function() {
|
||||
describe('AnalyticsController', function () {
|
||||
beforeEach(function () {
|
||||
this.AuthenticationController = { getLoggedInUserId: sinon.stub() }
|
||||
|
||||
this.AnalyticsManager = {
|
||||
@@ -42,8 +42,8 @@ describe('AnalyticsController', function() {
|
||||
}
|
||||
})
|
||||
|
||||
describe('updateEditingSession', function() {
|
||||
beforeEach(function() {
|
||||
describe('updateEditingSession', function () {
|
||||
beforeEach(function () {
|
||||
this.req = {
|
||||
params: {
|
||||
projectId: 'a project id'
|
||||
@@ -54,7 +54,7 @@ describe('AnalyticsController', function() {
|
||||
.callsArgWith(1, null, { country_code: 'XY' })
|
||||
})
|
||||
|
||||
it('delegates to the AnalyticsManager', function(done) {
|
||||
it('delegates to the AnalyticsManager', function (done) {
|
||||
this.AuthenticationController.getLoggedInUserId.returns('1234')
|
||||
this.controller.updateEditingSession(this.req, this.res)
|
||||
|
||||
@@ -65,8 +65,8 @@ describe('AnalyticsController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('recordEvent', function() {
|
||||
beforeEach(function() {
|
||||
describe('recordEvent', function () {
|
||||
beforeEach(function () {
|
||||
this.req = {
|
||||
params: {
|
||||
event: 'i_did_something'
|
||||
@@ -77,7 +77,7 @@ describe('AnalyticsController', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('should use the user_id', function(done) {
|
||||
it('should use the user_id', function (done) {
|
||||
this.AuthenticationController.getLoggedInUserId.returns('1234')
|
||||
this.controller.recordEvent(this.req, this.res)
|
||||
this.AnalyticsManager.recordEvent
|
||||
@@ -86,7 +86,7 @@ describe('AnalyticsController', function() {
|
||||
done()
|
||||
})
|
||||
|
||||
it('should use the session id', function(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.req.body)
|
||||
@@ -95,8 +95,8 @@ describe('AnalyticsController', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('licences', function() {
|
||||
beforeEach(function() {
|
||||
describe('licences', function () {
|
||||
beforeEach(function () {
|
||||
this.req = {
|
||||
query: {
|
||||
resource_id: 1,
|
||||
@@ -109,7 +109,7 @@ describe('AnalyticsController', function() {
|
||||
}
|
||||
})
|
||||
|
||||
it('should trigger institutions api to fetch licences graph data', function(done) {
|
||||
it('should trigger institutions api to fetch licences graph data', function (done) {
|
||||
this.controller.licences(this.req, this.res)
|
||||
this.InstitutionsAPI.getInstitutionLicences
|
||||
.calledWith(
|
||||
|
||||
@@ -7,8 +7,8 @@ const MODULE_PATH = path.join(
|
||||
'../../../../app/src/Features/Analytics/AnalyticsManager'
|
||||
)
|
||||
|
||||
describe('AnalyticsManager', function() {
|
||||
beforeEach(function() {
|
||||
describe('AnalyticsManager', function () {
|
||||
beforeEach(function () {
|
||||
this.fakeUserId = '123abc'
|
||||
this.Settings = {
|
||||
analytics: { enabled: true }
|
||||
@@ -47,22 +47,22 @@ describe('AnalyticsManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('ignores when', function() {
|
||||
it('user is smoke test user', function() {
|
||||
describe('ignores when', function () {
|
||||
it('user is smoke test user', function () {
|
||||
this.Settings.smokeTest = { userId: this.fakeUserId }
|
||||
this.AnalyticsManager.identifyUser(this.fakeUserId, '')
|
||||
sinon.assert.notCalled(this.analyticsEventsQueue.add)
|
||||
})
|
||||
|
||||
it('analytics service is disabled', function() {
|
||||
it('analytics service is disabled', function () {
|
||||
this.Settings.analytics.enabled = false
|
||||
this.AnalyticsManager.identifyUser(this.fakeUserId, '')
|
||||
sinon.assert.notCalled(this.analyticsEventsQueue.add)
|
||||
})
|
||||
})
|
||||
|
||||
describe('queues the appropriate message for', function() {
|
||||
it('identifyUser', function() {
|
||||
describe('queues the appropriate message for', function () {
|
||||
it('identifyUser', function () {
|
||||
const oldUserId = '456def'
|
||||
this.AnalyticsManager.identifyUser(this.fakeUserId, oldUserId)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'identify', {
|
||||
@@ -71,7 +71,7 @@ describe('AnalyticsManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('recordEvent', function() {
|
||||
it('recordEvent', function () {
|
||||
const event = 'fake-event'
|
||||
this.AnalyticsManager.recordEvent(this.fakeUserId, event, null)
|
||||
sinon.assert.calledWithMatch(this.analyticsEventsQueue.add, 'event', {
|
||||
@@ -81,7 +81,7 @@ describe('AnalyticsManager', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('updateEditingSession', function() {
|
||||
it('updateEditingSession', function () {
|
||||
const projectId = '789ghi'
|
||||
const countryCode = 'fr'
|
||||
this.AnalyticsManager.updateEditingSession(
|
||||
|
||||
Reference in New Issue
Block a user