@@ -1658,17 +1658,27 @@ describe('IsBase64', () => {
1658
1658
const validValues = [ 'aGVsbG8=' ] ;
1659
1659
const invalidValues = [ null , undefined , 'hell*mynameisalex' ] ;
1660
1660
1661
+ const validBase64UrlValues = [ 'dGVzdA' , 'dGV_zdA' ] ;
1662
+ const invalidBase64UrlValues = [ null , undefined , 'dGVzdA=' , 'MTIzNDU2Nzg5!!' , 'SGVsbG8+V29ybGQ=' ] ;
1663
+
1661
1664
class MyClass {
1662
1665
@IsBase64 ( )
1663
1666
someProperty : string ;
1664
1667
}
1665
1668
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 ) ;
1668
1677
} ) ;
1669
1678
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 ) ;
1672
1682
} ) ;
1673
1683
1674
1684
it ( 'should not fail if method in validator said that its valid' , ( ) => {
0 commit comments