From 4150baefcbe258b3274ac24ea60b29098b8bb280 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Tue, 14 Jan 2025 08:43:47 -0700 Subject: [PATCH] Merge pull request #22539 from overleaf/mf-move-plansbanners-helper-to-module [web] Move "plansBanners" function (along with its tests) to subscription module GitOrigin-RevId: a231ecd862e7f052ca2597eb07d6612b23f2c7d3 --- .../SubscriptionControllerTests.js | 324 ------------------ 1 file changed, 324 deletions(-) diff --git a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js index 67a7233ae9..d8cfce75eb 100644 --- a/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js +++ b/services/web/test/unit/src/Subscription/SubscriptionControllerTests.js @@ -272,114 +272,6 @@ describe('SubscriptionController', function () { }) }) - describe('showInrGeoBanner data', function () { - it('should return true for Indian Users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showInrGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'IN', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return false for US Users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showInrGeoBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - }) - - describe('showBrlGeoBanner data', function () { - it('should return true for Brazilian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showBrlGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'BR', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return false for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showBrlGeoBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - }) - - describe('showLATAMBanner', function () { - it('should return true for Mexican users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'MX', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return true for Colombian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CO', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return true for Chilean users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CL', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return true for Peruvian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'PE', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - it('should return true for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans') - opts.showLATAMBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPage(this.req, this.res) - }) - }) - describe('formatCurrency data', function () { it('return correct formatCurrency function', function (done) { this.res.render = (page, opts) => { @@ -485,114 +377,6 @@ describe('SubscriptionController', function () { }) }) - describe('showInrGeoBanner data', function () { - it('should return true for Indian Users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showInrGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'IN', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return false for US Users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showInrGeoBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - }) - - describe('showBrlGeoBanner data', function () { - it('should return true for Brazilian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showBrlGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'BR', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return false for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showBrlGeoBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - }) - - describe('showLATAMBanner', function () { - it('should return true for Mexican users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'MX', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return true for Colombian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CO', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return true for Chilean users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CL', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return true for Peruvian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'PE', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - it('should return true for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/plans-light-design') - opts.showLATAMBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.plansPageLightDesign(this.req, this.res) - }) - }) - describe('formatCurrency data', function () { it('return correct formatCurrency function', function (done) { this.res.render = (page, opts) => { @@ -646,114 +430,6 @@ describe('SubscriptionController', function () { }) }) - describe('showInrGeoBanner data', function () { - it('should return true for Indian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showInrGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'IN', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should be false for US users', function (done) { - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showInrGeoBanner.should.equal(false) - done() - } - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - }) - - describe('showBrlGeoBanner data', function () { - it('should return true for Brazilian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showBrlGeoBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'BR', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should return false for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showBrlGeoBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - }) - - describe('showLATAMBanner', function () { - it('should return true for Mexican users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'MX', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should return true for Colombian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CO', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should return true for Chilean users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'CL', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should return true for Peruvian users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showLATAMBanner.should.equal(true) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'PE', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - it('should return true for US users', function (done) { - this.res.render = (page, opts) => { - page.should.equal('subscriptions/interstitial-payment') - opts.showLATAMBanner.should.equal(false) - done() - } - this.GeoIpLookup.promises.getCurrencyCode.resolves({ - countryCode: 'US', - }) - this.SubscriptionController.interstitialPaymentPage(this.req, this.res) - }) - }) - it('should return correct countryCode', function (done) { this.GeoIpLookup.promises.getCurrencyCode.resolves({ countryCode: 'MX',