From d0517c00ea16d080fae7c7b76d7bcfc34f38f73b Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Wed, 29 Nov 2023 18:07:29 +0000 Subject: [PATCH] Add tests for date limits. --- test/20-dateRegex.spec.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/20-dateRegex.spec.js b/test/20-dateRegex.spec.js index 3f407861..44ef3d85 100644 --- a/test/20-dateRegex.spec.js +++ b/test/20-dateRegex.spec.js @@ -38,7 +38,7 @@ describe('verifies RFC3339 Dates', function() { }); }); describe('negative', function() { - it('should not verify a date that uses / as a separator', function() { + it('should not verify a date that uses "/" as a separator', function() { assertInvalid('2017/09/27'); }); it('should not verify 2 digit years', function() { @@ -60,5 +60,20 @@ describe('verifies RFC3339 Dates', function() { function() { assertInvalid('2019-03-26T14:00.9Z'); }); + it('should not verify a day greater than 31 in a month', function() { + assertInvalid('2017-03-45T15:00:15Z'); + }); + it('should not verify a month greater than 12 in a year', function() { + assertInvalid('2017-14-22T15:00:15Z'); + }); + it('should not verify an hour greater than 24', function() { + assertInvalid('2017-10-22T25:00:15Z'); + }); + it('should not verify minutes greater than 60', function() { + assertInvalid('2017-10-22T15:75:15Z'); + }); + it('should not verify seconds greater than 60', function() { + assertInvalid('2017-10-22T15:15:65Z'); + }); }); });