]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Adding specific tests from #430
authorTim Wood <washwithcare@gmail.com>
Wed, 5 Sep 2012 16:36:29 +0000 (09:36 -0700)
committerTim Wood <washwithcare@gmail.com>
Wed, 5 Sep 2012 16:36:29 +0000 (09:36 -0700)
test/moment/is_valid.js

index 92a54614bfbf2c5482af77f281ad287a498470dd..2e948b66692485056f528bc020f7d70ce14d654d 100644 (file)
@@ -50,7 +50,7 @@ exports.is_valid = {
     },
 
     "string + formats bad date" : function (test) {
-        test.expect(6);
+        test.expect(9);
 
         test.equal(moment('2020-00-00', ['YYYY-MM-DD', 'DD-MM-YYYY']).isValid(), false, 'invalid on all in array');
         test.equal(moment('2020-00-00', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), false, 'invalid on all in array');
@@ -59,6 +59,10 @@ exports.is_valid = {
         test.equal(moment('2020-01-01', ['YYYY-MM-DD', 'YYYY-DD-MM']).isValid(), true, 'valid on both');
         test.equal(moment('2020-13-01', ['YYYY-MM-DD', 'YYYY-DD-MM']).isValid(), true, 'valid on last');
 
+        test.equal(moment('12-13-2012', ['DD-MM-YYYY', 'YYYY-MM-DD']).isValid(), false, 'month rollover');
+        test.equal(moment('12-13-2012', ['DD-MM-YYYY', 'DD-MM-YYYY']).isValid(), false, 'month rollover');
+        test.equal(moment('38-12-2012', ['DD-MM-YYYY']).isValid(), false, 'day rollover');
+
         test.done();
     },