mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 12:51:35 +02:00
Merge pull request #5479 from overleaf/bg-refresh-features-on-editor-load
refresh user features on editor load when out of date GitOrigin-RevId: ef39b5626cfdc6ed611137a6f6eca3417d3ce73f
This commit is contained in:
@@ -105,6 +105,10 @@ describe('ProjectController', function () {
|
||||
this.Features = {
|
||||
hasFeature: sinon.stub(),
|
||||
}
|
||||
this.FeaturesUpdater = {
|
||||
featuresEpochIsCurrent: sinon.stub().returns(true),
|
||||
refreshFeatures: sinon.stub().yields(null, this.user),
|
||||
}
|
||||
this.BrandVariationsHandler = {
|
||||
getBrandVariationById: sinon
|
||||
.stub()
|
||||
@@ -167,6 +171,7 @@ describe('ProjectController', function () {
|
||||
'../Collaborators/CollaboratorsGetter': this.CollaboratorsGetter,
|
||||
'./ProjectEntityHandler': this.ProjectEntityHandler,
|
||||
'../../infrastructure/Features': this.Features,
|
||||
'../Subscription/FeaturesUpdater': this.FeaturesUpdater,
|
||||
'../Notifications/NotificationsBuilder': this.NotificationBuilder,
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
'../BrandVariations/BrandVariationsHandler': this
|
||||
@@ -1083,6 +1088,18 @@ describe('ProjectController', function () {
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should refresh the user features if the epoch is outdated', function (done) {
|
||||
this.FeaturesUpdater.featuresEpochIsCurrent = sinon.stub().returns(false)
|
||||
this.res.render = () => {
|
||||
this.FeaturesUpdater.refreshFeatures.should.have.been.calledWith(
|
||||
this.user._id,
|
||||
'load-editor'
|
||||
)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('pdf caching feature flags', function () {
|
||||
/* eslint-disable mocha/no-identical-title */
|
||||
function showNoVariant() {
|
||||
|
||||
Reference in New Issue
Block a user