File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff 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} ) ;
You can’t perform that action at this time.
0 commit comments