Skip to content

Commit 227a8b7

Browse files
author
Branko Vukelic
committed
Added failing test for isBefore() validator.
1 parent a81ea69 commit 227a8b7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/validator.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,20 @@ module.exports = {
541541
assert.throws(function() {
542542
Validator.check(f.yesterday).isAfter();
543543
});
544+
},
545+
546+
'test #isBefore()': function() {
547+
var f = dateFixture();
548+
549+
assert.ok(Validator.check('2011-08-04').isBefore('2011-08-06'));
550+
assert.ok(Validator.check('08. 04. 2011.').isBefore(new Date('2011-08-04')));
551+
assert.ok(Validator.check(f.yesterday).isBefore());
552+
553+
assert.throws(function() {
554+
Validator.check('08/04/2011').isBefore('2011-07-01');
555+
});
556+
assert.throws(function() {
557+
Validator.check(f.tomorrow).isBefore();
544558
});
545559
}
546560
}

0 commit comments

Comments
 (0)