PassValidator: NoSpecialCharacter Requirement
Finish the PassValidator exercise by implementing its last feature.
We'll cover the following
The Refactor phase
Before going ahead and implementing the last feature of the Validate
function, let’s recap the scenarios we’ve managed so far:
- Passwords shorter than eight characters.
- Passwords with less than two digits.
- Passwords without any capital letters.
- Passwords that don’t meet any combination of the previous points.
Now, we can start implementing the last feature.
No special character requirement
The last requirement states that if a password doesn’t contain any special characters (symbols), it should return the password must contain at least one special character
error.
The Red phase
As always, let’s start by writing a subtest that will take us to the Red phase. Let’s try the value aa3ab2cdA
:
Get hands-on with 1400+ tech skills courses.