Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Commit f02bf19

Browse files
committed
fix(confirm): change resend email limit to first 4 attempts (#3816) r=vbudhram
Fixes #3777
1 parent 0e96539 commit f02bf19

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

app/scripts/models/email-resend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define(function (require, exports, module) {
1111
var Constants = require('lib/constants');
1212

1313
function shouldResend (tries, maxTries) {
14-
return tries === 1 || tries === maxTries;
14+
return tries <= maxTries;
1515
}
1616

1717
var EmailResend = Backbone.Model.extend({

app/tests/spec/models/email-resend.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ define(function (require, exports, module) {
7878
});
7979

8080
describe('shouldResend', function () {
81-
it('it returns true to the 1st and 4th try only', function () {
81+
it('it returns true to the first 4 tries only', function () {
8282
emailResend = new EmailResend();
83-
assert.isFalse(emailResend.shouldResend());
83+
assert.isTrue(emailResend.shouldResend());
8484
emailResend.incrementRequestCount();
8585
assert.isTrue(emailResend.shouldResend());
8686
emailResend.incrementRequestCount();
87-
assert.isFalse(emailResend.shouldResend());
87+
assert.isTrue(emailResend.shouldResend());
8888
emailResend.incrementRequestCount();
89-
assert.isFalse(emailResend.shouldResend());
89+
assert.isTrue(emailResend.shouldResend());
9090
emailResend.incrementRequestCount();
9191
assert.isTrue(emailResend.shouldResend());
9292
for (var i = 0; i < 10; i++) {

app/tests/spec/views/confirm.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ define(function (require, exports, module) {
334334
assert.equal(count, 1);
335335
});
336336

337-
it('debounces resend calls - submit on first and forth attempt', function () {
337+
it('debounces resend calls - submit on first four attempts', function () {
338338
var count = 0;
339339

340340
sinon.stub(account, 'retrySignUp', function () {
@@ -345,15 +345,18 @@ define(function (require, exports, module) {
345345
return view.validateAndSubmit()
346346
.then(function () {
347347
assert.equal(count, 1);
348+
assert.equal(view.$('#resend:visible').length, 1);
348349
return view.validateAndSubmit();
349350
}).then(function () {
350-
assert.equal(count, 1);
351+
assert.equal(count, 2);
352+
assert.equal(view.$('#resend:visible').length, 1);
351353
return view.validateAndSubmit();
352354
}).then(function () {
353-
assert.equal(count, 1);
355+
assert.equal(count, 3);
356+
assert.equal(view.$('#resend:visible').length, 1);
354357
return view.validateAndSubmit();
355358
}).then(function () {
356-
assert.equal(count, 2);
359+
assert.equal(count, 4);
357360
assert.equal(view.$('#resend:visible').length, 0);
358361

359362
assert.isTrue(TestHelpers.isEventLogged(metrics,

app/tests/spec/views/confirm_reset_password.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ define(function (require, exports, module) {
590590
assert.equal(count, 1);
591591
});
592592

593-
it('debounces resend calls - submit on first and forth attempt', function () {
593+
it('debounces resend calls - submit on first four attempts', function () {
594594
sinon.stub(view, 'retryResetPassword', function () {
595595
return p(true);
596596
});
@@ -600,13 +600,13 @@ define(function (require, exports, module) {
600600
assert.equal(view.retryResetPassword.callCount, 1);
601601
return view.validateAndSubmit();
602602
}).then(function () {
603-
assert.equal(view.retryResetPassword.callCount, 1);
603+
assert.equal(view.retryResetPassword.callCount, 2);
604604
return view.validateAndSubmit();
605605
}).then(function () {
606-
assert.equal(view.retryResetPassword.callCount, 1);
606+
assert.equal(view.retryResetPassword.callCount, 3);
607607
return view.validateAndSubmit();
608608
}).then(function () {
609-
assert.equal(view.retryResetPassword.callCount, 2);
609+
assert.equal(view.retryResetPassword.callCount, 4);
610610
assert.equal(view.$('#resend:visible').length, 0);
611611

612612
assert.isTrue(TestHelpers.isEventLogged(metrics,

0 commit comments

Comments
 (0)