Skip to content

Commit 1a54fbf

Browse files
rubiinCopilot
andauthored
Update test/testFunctions.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4bfcb36 commit 1a54fbf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/testFunctions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ export default function test(options) {
1010
const args = options.args || [];
1111
const method = options.validator || options.sanitizer;
1212

13+
if (!method) {
14+
throw new Error('test() requires either "validator" or "sanitizer" option');
15+
}
16+
17+
if (typeof validator[method] !== 'function') {
18+
throw new Error(format(
19+
'test() received invalid validator/sanitizer "%s"; expected a function name exported by validator',
20+
method
21+
));
22+
}
1323
args.unshift(null);
1424

1525
if (options.expect) {

0 commit comments

Comments
 (0)