Skip to content

Commit

Permalink
fix: validateOptions should ignore unknown properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Aug 13, 2022
1 parent 8db4a7d commit 8e2af40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/verifier/validateOptions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,15 @@ describe('Verifier argument validator', () => {
).to.not.throw(Error);
});
});

context('when given unknown properties', () => {
it('should ignore them and not throw an error', () => {
expect(() =>
validateOptions({
providerBaseUrl: 'http://localhost',
randomobjectwithnorules: 'poop',
} as any as VerifierOptions)
).to.not.throw(Error);
});
});
});
2 changes: 1 addition & 1 deletion src/verifier/validateOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const validateOptions = (options: VerifierOptions): VerifierOptions => {
});
});
} else {
rules.map((rule) => {
(rules || []).map((rule) => {
rule(options)(options[k], k);
});
}
Expand Down

0 comments on commit 8e2af40

Please sign in to comment.