Bug 1503751 - Increase year for check of valid credit card if current month is near end of year. r=MattN on IRC a=Aryx
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 01 Nov 2018 03:03:17 +0200
changeset 492964 f91ac8ecb4dc
parent 492963 92e511ba4fa3
child 492965 defc169a1ee3
push id1842
push usercbrindusan@mozilla.com
push dateThu, 01 Nov 2018 01:29:51 +0000
treeherdermozilla-release@f91ac8ecb4dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, Aryx
bugs1503751
milestone63.0.2
Bug 1503751 - Increase year for check of valid credit card if current month is near end of year. r=MattN on IRC a=Aryx
toolkit/modules/tests/xpcshell/test_CreditCard.js
--- a/toolkit/modules/tests/xpcshell/test_CreditCard.js
+++ b/toolkit/modules/tests/xpcshell/test_CreditCard.js
@@ -153,17 +153,19 @@ add_task(function test_isValid() {
       ok(!card.isValid(), message);
     }
   }
   let year = (new Date()).getFullYear();
   let month = (new Date()).getMonth() + 1;
 
   testValid("0000000000000000", month, year + 2, true,
     "Valid number and future expiry date (two years) should pass");
-  testValid("0000000000000000", month + 2, year, true,
+  testValid("0000000000000000",
+    (month < 11 ? month + 2 : month % 10), (month < 11 ? year : year + 1),
+    true,
     "Valid number and future expiry date (two months) should pass");
   testValid("0000000000000000", month, year, true,
     "Valid number and expiry date equal to this month should pass");
   testValid("0000000000000000", month - 1, year, false,
     "Valid number but overdue expiry date should fail");
   testValid("0000000000000000", month, year - 1, false,
     "Valid number but overdue expiry date (by a year) should fail");
   testValid("0000000000000001", month, year + 2, false,