Skip to content

Commit 253e054

Browse files
committed
test(schematype): repro #8360
1 parent 1eaefc8 commit 253e054

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/schema.type.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,17 @@ describe('schematype', function() {
8787
assert.ifError(err);
8888
});
8989
});
90+
91+
it('handles function as positional message arg (gh-8360)', function() {
92+
const schema = Schema({
93+
name: {
94+
type: String,
95+
validate: [() => false, err => `${err.path} is invalid!`]
96+
}
97+
});
98+
99+
const err = schema.path('name').doValidateSync('test');
100+
assert.equal(err.name, 'ValidatorError');
101+
assert.equal(err.message, 'name is invalid!');
102+
});
90103
});

0 commit comments

Comments
 (0)