Skip to content

Commit

Permalink
Reinstate legacy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbucket-dev committed Oct 25, 2022
1 parent 62c2e22 commit e907cde
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/validators/isBefore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,41 @@ describe('isBefore', () => {
invalid: ['invalid date', '1999-12-31'],
});
});

describe('(legacy syntax)', () => {
it('should validate dates against an end date', () => {
test({
validator: 'isBefore',
args: ['08/04/2011'],
valid: ['2010-07-02', '2010-08-04', new Date(0).toString()],
invalid: ['08/04/2011', new Date(2011, 9, 10).toString()],
});
test({
validator: 'isBefore',
args: [new Date(2011, 7, 4).toString()],
valid: ['2010-07-02', '2010-08-04', new Date(0).toString()],
invalid: ['08/04/2011', new Date(2011, 9, 10).toString()],
});
test({
validator: 'isBefore',
valid: [
'2000-08-04',
new Date(0).toString(),
new Date(Date.now() - 86400000).toString(),
],
invalid: ['2100-07-02', new Date(2217, 10, 10).toString()],
});
test({
validator: 'isBefore',
args: ['2011-08-03'],
valid: ['1999-12-31'],
invalid: ['invalid date'],
});
test({
validator: 'isBefore',
args: ['invalid date'],
invalid: ['invalid date', '1999-12-31'],
});
});
});
});

0 comments on commit e907cde

Please sign in to comment.