Skip to content

Commit fe8cd1d

Browse files
committed
fix regex expression for special chars
1 parent be14793 commit fe8cd1d

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

Sprint-3/4-stretch/password-validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function passwordValidator(
1515
!/[A-Z]/.test(password) ||
1616
!/[a-z]/.test(password) ||
1717
!/[0-9]/.test(password) ||
18-
!/[!#\$%\.\*&]/.test(password) ||
18+
!/[!#$%.*&]/.test(password) ||
1919
usedPasswords.includes(password)
2020
) {
2121
return false;

Sprint-3/4-stretch/password-validator.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ test("password has at least one non-alphanumeric symbol: (!, #, $, %, ., *, &)",
9696
expect(result).toEqual(true);
9797
});
9898

99+
test("password has at least one non-alphanumeric symbol: (!, #, $, %, ., *, &)", () => {
100+
// Arrange
101+
const password = "12aA$12";
102+
// Act
103+
const result = isValidPassword(password);
104+
// Assert
105+
expect(result).toEqual(true);
106+
});
107+
99108
test("must not be any previous password in the passwords array.", () => {
100109
// Arrange
101110
const password = "pas$W0rd";

0 commit comments

Comments
 (0)