Skip to content

Commit

Permalink
test(schematype): repro #8360
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 4, 2019
1 parent 1eaefc8 commit 253e054
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/schema.type.test.js
Expand Up @@ -87,4 +87,17 @@ describe('schematype', function() {
assert.ifError(err);
});
});

it('handles function as positional message arg (gh-8360)', function() {
const schema = Schema({
name: {
type: String,
validate: [() => false, err => `${err.path} is invalid!`]
}
});

const err = schema.path('name').doValidateSync('test');
assert.equal(err.name, 'ValidatorError');
assert.equal(err.message, 'name is invalid!');
});
});

0 comments on commit 253e054

Please sign in to comment.