mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 08:09:01 +02:00
[web] use a global shared mock for the metrics module (#32799)
GitOrigin-RevId: 72874ba6c06c2a602b01cc029bc9c71ce3ce8892
This commit is contained in:
@@ -31,10 +31,6 @@ describe('ProjectDownloadsController', function () {
|
||||
default: (ctx.ProjectGetter = {}),
|
||||
}))
|
||||
|
||||
vi.doMock('@overleaf/metrics', () => ({
|
||||
default: (ctx.metrics = {}),
|
||||
}))
|
||||
|
||||
vi.doMock(
|
||||
'../../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler.mjs',
|
||||
() => ({
|
||||
@@ -75,7 +71,7 @@ describe('ProjectDownloadsController', function () {
|
||||
ctx.DocumentUpdaterHandler.flushProjectToMongo = sinon
|
||||
.stub()
|
||||
.callsArgWith(1)
|
||||
ctx.metrics.inc = sinon.stub()
|
||||
ctx.Metrics.inc = sinon.stub()
|
||||
return ctx.ProjectDownloadsController.downloadProject(
|
||||
ctx.req,
|
||||
ctx.res,
|
||||
@@ -119,7 +115,7 @@ describe('ProjectDownloadsController', function () {
|
||||
})
|
||||
|
||||
it('should record the action via Metrics', function (ctx) {
|
||||
return ctx.metrics.inc.calledWith('zip-downloads').should.equal(true)
|
||||
return ctx.Metrics.inc.calledWith('zip-downloads').should.equal(true)
|
||||
})
|
||||
|
||||
it('should add an audit log entry', function (ctx) {
|
||||
@@ -152,7 +148,7 @@ describe('ProjectDownloadsController', function () {
|
||||
ctx.DocumentUpdaterHandler.flushMultipleProjectsToMongo = sinon
|
||||
.stub()
|
||||
.callsArgWith(1)
|
||||
ctx.metrics.inc = sinon.stub()
|
||||
ctx.Metrics.inc = sinon.stub()
|
||||
return ctx.ProjectDownloadsController.downloadMultipleProjects(
|
||||
ctx.req,
|
||||
ctx.res,
|
||||
@@ -191,7 +187,7 @@ describe('ProjectDownloadsController', function () {
|
||||
})
|
||||
|
||||
it('should record the action via Metrics', function (ctx) {
|
||||
return ctx.metrics.inc
|
||||
return ctx.Metrics.inc
|
||||
.calledWith('zip-downloads-multiple')
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user