Merge pull request #17230 from overleaf/mf-tear-down-inr-2

[web] Tear down INR split test

GitOrigin-RevId: 90c6ab4666d9281e804b279d697d6c14ffd682d2
This commit is contained in:
M Fahru
2024-02-21 07:02:03 -07:00
committed by Copybot
parent 23281255a1
commit dc9b0aa8a5
18 changed files with 233 additions and 228 deletions
@@ -126,6 +126,14 @@ describe('ProjectListController', function () {
getUserSubscription: sinon.stub().resolves({}),
},
}
this.GeoIpLookup = {
promises: {
getCurrencyCode: sinon.stub().resolves({
countryCode: 'US',
currencyCode: 'USD',
}),
},
}
this.ProjectListController = SandboxedModule.require(MODULE_PATH, {
requires: {
@@ -155,6 +163,7 @@ describe('ProjectListController', function () {
this.UserPrimaryEmailCheckHandler,
'../Notifications/NotificationsBuilder': this.NotificationBuilder,
'../Subscription/SubscriptionLocator': this.SubscriptionLocator,
'../../infrastructure/GeoIpLookup': this.GeoIpLookup,
},
})
@@ -310,6 +319,38 @@ describe('ProjectListController', function () {
this.ProjectListController.projectListPage(this.req, this.res)
})
it('should show INR Banner for Indian users with free account', function (done) {
// usersBestSubscription is only available when saas feature is present
this.Features.hasFeature.withArgs('saas').returns(true)
this.SubscriptionViewModelBuilder.promises.getBestSubscription.resolves({
type: 'free',
})
this.GeoIpLookup.promises.getCurrencyCode.resolves({
countryCode: 'IN',
})
this.res.render = (pageName, opts) => {
expect(opts.showInrGeoBanner).to.be.true
done()
}
this.ProjectListController.projectListPage(this.req, this.res)
})
it('should not show INR Banner for Indian users with premium account', function (done) {
// usersBestSubscription is only available when saas feature is present
this.Features.hasFeature.withArgs('saas').returns(true)
this.SubscriptionViewModelBuilder.promises.getBestSubscription.resolves({
type: 'individual',
})
this.GeoIpLookup.promises.getCurrencyCode.resolves({
countryCode: 'IN',
})
this.res.render = (pageName, opts) => {
expect(opts.showInrGeoBanner).to.be.false
done()
}
this.ProjectListController.projectListPage(this.req, this.res)
})
describe('With Institution SSO feature', function () {
beforeEach(function (done) {
this.institutionEmail = 'test@overleaf.com'