mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 15:10:48 +02:00
Check features before showing upgrade prompts
GitOrigin-RevId: 6f0ed9eca88197e1160b149cb304e27075aa0627
This commit is contained in:
@@ -524,7 +524,8 @@ describe('ProjectController', function () {
|
||||
this.ProjectController.projectListPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it("should send the user's best subscription", function (done) {
|
||||
it("should send the user's best subscription when saas feature present", function (done) {
|
||||
this.Features.hasFeature.withArgs('saas').returns(true)
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.usersBestSubscription).to.deep.include({ type: 'free' })
|
||||
done()
|
||||
@@ -532,6 +533,15 @@ describe('ProjectController', function () {
|
||||
this.ProjectController.projectListPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should not return a best subscription without saas feature', function (done) {
|
||||
this.Features.hasFeature.withArgs('saas').returns(false)
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.usersBestSubscription).to.be.undefined
|
||||
done()
|
||||
}
|
||||
this.ProjectController.projectListPage(this.req, this.res)
|
||||
})
|
||||
|
||||
describe('front widget', function (done) {
|
||||
beforeEach(function () {
|
||||
this.settings.overleaf = {
|
||||
@@ -1404,11 +1414,21 @@ describe('ProjectController', function () {
|
||||
|
||||
describe('persistent upgrade prompt', function () {
|
||||
beforeEach(function () {
|
||||
// default to saas enabled
|
||||
this.Features.hasFeature.withArgs('saas').returns(true)
|
||||
// default to without a subscription
|
||||
this.SubscriptionLocator.getUsersSubscription = sinon
|
||||
.stub()
|
||||
.callsArgWith(1, null, null)
|
||||
})
|
||||
it('should not show without the saas feature', function (done) {
|
||||
this.Features.hasFeature.withArgs('saas').returns(false)
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.showHeaderUpgradePrompt).to.equal(false)
|
||||
done()
|
||||
}
|
||||
this.ProjectController.loadEditor(this.req, this.res)
|
||||
})
|
||||
it('should show for a user without a subscription or only non-paid affiliations', function (done) {
|
||||
this.res.render = (pageName, opts) => {
|
||||
expect(opts.showHeaderUpgradePrompt).to.equal(true)
|
||||
|
||||
Reference in New Issue
Block a user