mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 23:20:47 +02:00
Merge pull request #8886 from overleaf/jpa-pdf-caching-alpha
[web] prepare alpha release of pdf caching GitOrigin-RevId: 5617dd443da57b7077db793c2bc39be35ec44ef1
This commit is contained in:
@@ -1126,77 +1126,6 @@ describe('ProjectController', function () {
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('pdf caching feature flags', function () {
|
||||
function expectBandwidthTrackingEnabled() {
|
||||
it('should track pdf bandwidth', function (done) {
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.trackPdfDownload).to.equal(true)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
}
|
||||
function expectPDFCachingEnabled(mode) {
|
||||
it('should enable pdf caching', function (done) {
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.pdfCachingMode).to.equal(mode)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
}
|
||||
function expectBandwidthTrackingDisabled() {
|
||||
it('should not track pdf bandwidth', function (done) {
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.trackPdfDownload).to.equal(false)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
}
|
||||
function expectPDFCachingDisabled() {
|
||||
it('should disable pdf caching', function (done) {
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.pdfCachingMode).to.equal('')
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
this.settings.enablePdfCaching = true
|
||||
})
|
||||
|
||||
describe('during opt-in only', function () {
|
||||
describe('with no query', function () {
|
||||
expectBandwidthTrackingDisabled()
|
||||
expectPDFCachingDisabled()
|
||||
})
|
||||
|
||||
describe('with track-pdf-download=false', function () {
|
||||
beforeEach(function () {
|
||||
this.req.query['track-pdf-download'] = 'false'
|
||||
})
|
||||
expectBandwidthTrackingDisabled()
|
||||
})
|
||||
|
||||
describe('with track-pdf-download=true', function () {
|
||||
beforeEach(function () {
|
||||
this.req.query['track-pdf-download'] = 'true'
|
||||
})
|
||||
expectBandwidthTrackingEnabled()
|
||||
})
|
||||
|
||||
describe('with pdf-caching-mode=enabled', function () {
|
||||
beforeEach(function () {
|
||||
this.req.query['pdf-caching-mode'] = 'enabled'
|
||||
})
|
||||
expectPDFCachingEnabled('enabled')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('wsUrl', function () {
|
||||
function checkLoadEditorWsMetric(metric) {
|
||||
it(`should inc metric ${metric}`, function (done) {
|
||||
|
||||
Reference in New Issue
Block a user