@@ -516,7 +516,9 @@ void main() {
516
516
// Fail
517
517
expect (validator ('13/23' ), isNotNull);
518
518
519
- final validatorNoExpiredCheck = FormBuilderValidators .creditCardExpirationDate (checkForExpiration: false );
519
+ final validatorNoExpiredCheck =
520
+ FormBuilderValidators .creditCardExpirationDate (
521
+ checkForExpiration: false );
520
522
// Pass
521
523
expect (validatorNoExpiredCheck ('12/23' ), isNull);
522
524
// Fail
@@ -717,6 +719,59 @@ void main() {
717
719
expect (validator ('hellohello1@' ), isNotNull);
718
720
expect (validator ('Hellohello1' ), isNotNull);
719
721
expect (validator ('Hellohello@' ), isNotNull);
722
+
723
+ // Fail - only lowercase
724
+ expect (validator ('lowercasepassword' ), isNotNull);
725
+
726
+ // Fail - only uppercase
727
+ expect (validator ('UPPERCASEPASSWORD' ), isNotNull);
728
+
729
+ // Fail - only numbers
730
+ expect (validator ('1234567890' ), isNotNull);
731
+
732
+ // Fail - only special chars
733
+ expect (validator ('~!@#%^&*' ), isNotNull);
734
+
735
+ // Fail - weak password
736
+ expect (validator ('password123' ), isNotNull);
737
+
738
+ // Fail - empty password
739
+ expect (validator ('' ), isNotNull);
740
+
741
+ // Fail - whitespace only
742
+ expect (validator (' ' ), isNotNull);
743
+
744
+ // Fail - similar characters
745
+ expect (validator ('aaaaaa1111' ), isNotNull);
746
+
747
+ final customValidator = FormBuilderValidators .password (
748
+ minLength: 4 ,
749
+ maxLength: 16 ,
750
+ uppercase: 3 ,
751
+ lowercase: 3 ,
752
+ number: 3 ,
753
+ specialChar: 3 ,
754
+ );
755
+ // Pass - meets all requirements
756
+ expect (customValidator ('PASsw0rd@123!!' ), isNull);
757
+
758
+ // Fail - less than min length
759
+ expect (customValidator ('Pass@12' ), isNotNull);
760
+
761
+ // Fail - more than max length
762
+ expect (customValidator ('ThisIsAP@ssw0rd1234' ), isNotNull);
763
+
764
+ // Fail - missing uppercase chars
765
+ expect (customValidator ('password@123' ), isNotNull);
766
+
767
+ // Fail - missing lowercase chars
768
+ expect (customValidator ('PASSWORD@123' ), isNotNull);
769
+
770
+ // Fail - missing number
771
+ expect (customValidator ('Password@abc' ), isNotNull);
772
+
773
+ // Fail - missing special char
774
+ expect (customValidator ('Password123abc' ), isNotNull);
720
775
}),
721
776
);
722
777
}
0 commit comments