Merge pull request #2651 from overleaf/ta-missing-return

Add Missing Return

GitOrigin-RevId: aeb622a6745678eb687217beeb49b5d023168052
This commit is contained in:
nate stemen 2020-03-05 10:42:19 -05:00 committed by Copybot
parent 818d19bd69
commit 6379f15815
2 changed files with 13 additions and 1 deletions

View file

@ -206,7 +206,7 @@ module.exports = SubscriptionController = {
}
if (hasSubscription) {
logger.warn({ user_id: user._id }, 'user already has subscription')
res.sendStatus(409) // conflict
return res.sendStatus(409) // conflict
}
return SubscriptionHandler.createSubscription(
user,

View file

@ -419,6 +419,18 @@ describe('SubscriptionController', function() {
})
describe('createSubscription with errors', function() {
it('should handle users with subscription', function(done) {
this.LimitationsManager.userHasV1OrV2Subscription.yields(null, true)
this.SubscriptionController.createSubscription(this.req, {
sendStatus: status => {
expect(status).to.equal(409)
this.SubscriptionHandler.createSubscription.called.should.equal(false)
done()
}
})
})
it('should handle 3DSecure errors', function(done) {
this.next = sinon.stub()
this.LimitationsManager.userHasV1OrV2Subscription.yields(null, false)