@@ -1658,17 +1658,27 @@ describe('IsBase64', () => {
16581658 const validValues = [ 'aGVsbG8=' ] ;
16591659 const invalidValues = [ null , undefined , 'hell*mynameisalex' ] ;
16601660
1661+ const validBase64UrlValues = [ 'dGVzdA' , 'dGV_zdA' ] ;
1662+ const invalidBase64UrlValues = [ null , undefined , 'dGVzdA=' , 'MTIzNDU2Nzg5!!' , 'SGVsbG8+V29ybGQ=' ] ;
1663+
16611664 class MyClass {
16621665 @IsBase64 ( )
16631666 someProperty : string ;
16641667 }
16651668
1666- it ( 'should not fail if validator.validate said that its valid' , ( ) => {
1667- return checkValidValues ( new MyClass ( ) , validValues ) ;
1669+ class MyClassWithConstraint {
1670+ @IsBase64 ( { urlSafe : true } )
1671+ someProperty : string ;
1672+ }
1673+
1674+ it ( 'should not fail if validator.validate said that its valid' , async ( ) => {
1675+ await checkValidValues ( new MyClass ( ) , validValues ) ;
1676+ await checkValidValues ( new MyClassWithConstraint ( ) , validBase64UrlValues ) ;
16681677 } ) ;
16691678
1670- it ( 'should fail if validator.validate said that its invalid' , ( ) => {
1671- return checkInvalidValues ( new MyClass ( ) , invalidValues ) ;
1679+ it ( 'should fail if validator.validate said that its invalid' , async ( ) => {
1680+ await checkInvalidValues ( new MyClass ( ) , invalidValues ) ;
1681+ await checkInvalidValues ( new MyClassWithConstraint ( ) , invalidBase64UrlValues ) ;
16721682 } ) ;
16731683
16741684 it ( 'should not fail if method in validator said that its valid' , ( ) => {
0 commit comments