Unit tests has been created for each validator in this module using Vitest and can be found in the src/__tests__/ folder. A summary of the test results can be found at the end of the Tests section.
npm run test
-
Positive testing
- Valid Short format date
- Valid Long format date
- Valid ISO format date
-
Negative testing
- Day number over 31 or under 1.
- Month number over 12 or under 1.
- Year number under 1.
- Month name in long format spelt wrong.
- Date doesn't exist (e.g February 31).
- No comma in long date.
-
Positive testing
- Valid E-mail string.
-
Negative testing
- Too short top level domain name.
- Invalid characters.
- Consecutive allowed special character.
- Doesn't contain "@" character.
-
Positive testing
- Valid password string.
- Contains lower case letter.
- Contains upper case letter.
- Contains number.
- Contains special character.
- Valid password string length.
-
Negative testing
- Too short password.
- Doesn't contain lower case letter.
- Doesn't contain upper case letter.
- Doesn't contain number.
- Doesn't contain special character.
-
Positive testing
- Valid URL string.
- Valid port number.
- Valid query.
- Valid fragment.
-
Negative testing
- Consecutive periods in hostname.
- Too long hostname.
- Too long port number.
- Invalid protocol.
-
Positive testing
- Valid username string.
-
Negative testing
- Consecutive allowed special characters.
- Too long username.
- Too short username.
- Invalid characters.
