Open alexanderankin opened 7 years ago
also came across this:
var Validator = require('validatorjs');
var data = { baseTracks: '' };
var rules = {
baseTracks: 'array',
};
var validation = new Validator(data, rules);
console.log(validation.passes()); // true
console.log(validation.fails()); // false
the problem is in _isValidatable method. it uses rule "required" and interprets results in strange manner. null and undefined is not "isValidatable" but, also empty string too. so u can place any (which not in "implicit" array) rule in "rules" and get "true"
There is no way to write a test which accepts only Arrays including empty array. also your unit tests for custom tests arent reflective of this case: