@@ -14,58 +14,58 @@ To be valid, a password must:
1414
1515You must breakdown this problem in order to solve it. Find one test case first and get that working
1616*/
17- const isValidPassword = require("./password-validator");
17+ const { isValidPassword, previousPasswords } = require("./password-validator");
1818
1919describe("passwordValidator", () => {
2020 const validPassword = "123Ab*";
2121
2222 test("returns true for passwords with at least 5 characters", () => {
23- expect(isValidPassword(validPassword)).toBe(true);
23+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
2424 });
2525
2626 test("return true for passwords with at least one uppercase letter", () => {
27- expect(isValidPassword(validPassword)).toBe(true);
27+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
2828 });
2929
3030 test("return true for passwords with at least one lowercase letter", () => {
31- expect(isValidPassword(validPassword)).toBe(true);
31+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
3232 });
3333
3434 test("return true for passwords with at least one number", () => {
35- expect(isValidPassword(validPassword)).toBe(true);
35+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
3636 });
3737
3838 test("return true for passwords with at least one non-alphanumeric symbol", () => {
39- expect(isValidPassword(validPassword)).toBe(true);
39+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
4040 });
4141
4242 test("return true for passwords that are not in the previous passwords array", () => {
43- expect(isValidPassword(validPassword)).toBe(true);
43+ expect(isValidPassword(validPassword, previousPasswords )).toBe(true);
4444 });
4545
4646 // tests for false cases
4747
4848 test("returns false for passwords with less than 5 characters", () => {
49- expect(isValidPassword("1234")).toBe(false);
49+ expect(isValidPassword("1234", previousPasswords )).toBe(false);
5050 });
5151
5252 test("returns false for passwords without an uppercase letter", () => {
53- expect(isValidPassword("123ab*")).toBe(false);
53+ expect(isValidPassword("123ab*", previousPasswords )).toBe(false);
5454 });
5555
5656 test("returns false for passwords without a lowercase letter", () => {
57- expect(isValidPassword("123AB*")).toBe(false);
57+ expect(isValidPassword("123AB*", previousPasswords )).toBe(false);
5858 });
5959
6060 test("returns false for passwords without a number", () => {
61- expect(isValidPassword("abAB*")).toBe(false);
61+ expect(isValidPassword("abAB*", previousPasswords )).toBe(false);
6262 });
6363
6464 test("returns false for passwords without a non-alphanumeric symbol", () => {
65- expect(isValidPassword("123Abc")).toBe(false);
65+ expect(isValidPassword("123Abc", previousPasswords )).toBe(false);
6666 });
6767
6868 test("returns false for passwords that are in the previous passwords array", () => {
69- expect(isValidPassword("123Ab!")).toBe(false);
69+ expect(isValidPassword("123Ab!", previousPasswords )).toBe(false);
7070 });
7171});
0 commit comments