Skip to content

Commit 791b52a

Browse files
committed
adding tests for false cases
1 parent 9447d08 commit 791b52a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,30 @@ describe("passwordValidator", () => {
4242
test("return true for passwords that are not in the previous passwords array", () => {
4343
expect(isValidPassword(validPassword)).toBe(true);
4444
});
45+
46+
// tests for false cases
47+
48+
test("returns false for passwords with less than 5 characters", () => {
49+
expect(isValidPassword("1234")).toBe(false);
50+
});
51+
52+
test("returns false for passwords without an uppercase letter", () => {
53+
expect(isValidPassword("123ab*")).toBe(false);
54+
});
55+
56+
test("returns false for passwords without a lowercase letter", () => {
57+
expect(isValidPassword("123AB*")).toBe(false);
58+
});
59+
60+
test("returns false for passwords without a number", () => {
61+
expect(isValidPassword("abAB*")).toBe(false);
62+
});
63+
64+
test("returns false for passwords without a non-alphanumeric symbol", () => {
65+
expect(isValidPassword("123Abc")).toBe(false);
66+
});
67+
68+
test("returns false for passwords that are in the previous passwords array", () => {
69+
expect(isValidPassword("123Ab!")).toBe(false);
70+
});
4571
});

0 commit comments

Comments
 (0)