Merge pull request #4672 from overleaf/sk-validate-currency-param
Subscription: validate currency in query param GitOrigin-RevId: 0c9f841ba56b5ce85bbd2adeb3fb2d45d0ad753a
This commit is contained in:
@@ -108,6 +108,7 @@ describe('SubscriptionController', function () {
|
||||
gaExperiments: {},
|
||||
}
|
||||
this.GeoIpLookup = {
|
||||
isValidCurrencyParam: sinon.stub().returns(true),
|
||||
getCurrencyCode: sinon.stub(),
|
||||
promises: {
|
||||
getCurrencyCode: sinon.stub(),
|
||||
@@ -263,6 +264,16 @@ describe('SubscriptionController', function () {
|
||||
}
|
||||
this.SubscriptionController.paymentPage(this.req, this.res)
|
||||
})
|
||||
|
||||
it('should use the geo ip currency if not valid', function (done) {
|
||||
this.req.query.currency = 'WAT'
|
||||
this.GeoIpLookup.isValidCurrencyParam.returns(false)
|
||||
this.res.render = (page, opts) => {
|
||||
opts.currency.should.equal(this.stubbedCurrencyCode)
|
||||
done()
|
||||
}
|
||||
this.SubscriptionController.paymentPage(this.req, this.res)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a recurly subscription already', function () {
|
||||
|
||||
Reference in New Issue
Block a user