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 500966 d0d49443a8f165c5c9ba1175fc440d92d131131b
parent 500965 5322ecba281dc3984def67eeb004c8a95b3cbd90
child 500967 9a6df052c3803285086d6634942ddec827f6fa43
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, Aryx
bugs1503751
milestone64.0
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
@@ -179,17 +179,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,