@@ -268,6 +268,38 @@ describe("Predefined Validators", function () {
268268 } ) ;
269269
270270
271+ describe ( "password()" , function ( ) {
272+ it ( "should pass 'Passw0r∂'" , function ( done ) {
273+ validators . password ( ) ( 'Passw0r∂' , checkValidation ( done ) ) ;
274+ } ) ;
275+ it ( "should not pass 'password' with 'weak-password'" , function ( done ) {
276+ validators . password ( ) ( 'password' , checkValidation ( done , 'weak-password' ) ) ;
277+ } ) ;
278+ it ( "should not pass 'Passw0rd' with 'weak-password'" , function ( done ) {
279+ validators . password ( ) ( 'Passw0rd' , checkValidation ( done , 'weak-password' ) ) ;
280+ } ) ;
281+ } ) ;
282+
283+
284+ describe ( "password('ln4', 'bad-pwd')" , function ( ) {
285+ it ( "should pass 'Passw0r∂'" , function ( done ) {
286+ validators . password ( 'ln4' , 'bad-pwd' ) ( 'Passw0r∂' , checkValidation ( done ) ) ;
287+ } ) ;
288+ it ( "should pass 'Passw0rd'" , function ( done ) {
289+ validators . password ( 'ln4' , 'bad-pwd' ) ( 'Passw0rd' , checkValidation ( done ) ) ;
290+ } ) ;
291+ it ( "should not pass 'P12345' with 'bad-pwd'" , function ( done ) {
292+ validators . password ( 'ln4' , 'bad-pwd' ) ( 'P12345' , checkValidation ( done , 'bad-pwd' ) ) ;
293+ } ) ;
294+ it ( "should not pass 'password' with 'bad-pwd'" , function ( done ) {
295+ validators . password ( 'ln4' , 'bad-pwd' ) ( 'password' , checkValidation ( done , 'bad-pwd' ) ) ;
296+ } ) ;
297+ it ( "should not pass 'p12' with 'bad-pwd'" , function ( done ) {
298+ validators . password ( 'ln4' , 'bad-pwd' ) ( 'p12' , checkValidation ( done , 'bad-pwd' ) ) ;
299+ } ) ;
300+ } ) ;
301+
302+
271303 describe ( "patterns.hexString()" , function ( ) {
272304 it ( "should pass 'ABCDEF0123456789'" , function ( done ) {
273305 validators . patterns . hexString ( ) ( 'ABCDEF0123456789' , checkValidation ( done ) ) ;
0 commit comments