Skip to content

Commit 8e2af40

Browse files
committed
fix: validateOptions should ignore unknown properties
1 parent 8db4a7d commit 8e2af40

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/verifier/validateOptions.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,15 @@ describe('Verifier argument validator', () => {
396396
).to.not.throw(Error);
397397
});
398398
});
399+
400+
context('when given unknown properties', () => {
401+
it('should ignore them and not throw an error', () => {
402+
expect(() =>
403+
validateOptions({
404+
providerBaseUrl: 'http://localhost',
405+
randomobjectwithnorules: 'poop',
406+
} as any as VerifierOptions)
407+
).to.not.throw(Error);
408+
});
409+
});
399410
});

src/verifier/validateOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export const validateOptions = (options: VerifierOptions): VerifierOptions => {
262262
});
263263
});
264264
} else {
265-
rules.map((rule) => {
265+
(rules || []).map((rule) => {
266266
rule(options)(options[k], k);
267267
});
268268
}

0 commit comments

Comments
 (0)