Skip to content

Commit 87000a7

Browse files
authored
Merge branch 'develop' into develop
2 parents a2156a1 + 0ea279b commit 87000a7

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ updates:
66
interval: daily
77
time: "10:00"
88
timezone: Europe/Budapest
9-
open-pull-requests-limit: 5
9+
open-pull-requests-limit: 0
1010
versioning-strategy: increase
1111
commit-message:
1212
prefix: build
1313
include: scope
1414
ignore:
15-
- dependency-name: "husky"
15+
- dependency-name: "husky"

src/decorator/string/IsBase64.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function IsBase64(
2626
name: IS_BASE64,
2727
constraints: [options],
2828
validator: {
29-
validate: (value, args): boolean => isBase64(value),
29+
validate: (value, args): boolean => isBase64(value, args?.constraints[0]),
3030
defaultMessage: buildMessage(eachPrefix => eachPrefix + '$property must be base64 encoded', validationOptions),
3131
},
3232
},

test/functional/validation-functions-and-decorators.spec.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)