Closed br0r closed 9 years ago
Are you perhaps referring to this line in the anyvalidator-test?
(Duns.any(undefined).assert).should.throw();
This is a syntax-confusion with mocha/should. You give the function, without executing it, to the should-validator. It is then later on executed(this is so should can wrap it inside a try/catch block).
Thus, the syntax for using assert in duns is,
var schema = Duns.object().keys({
test : Duns.number(),
});
schema.init('100').assert(); //throws
schema.assert('100'); //throws
The documentation has been updated to illuminate this syntax.
What is the current syntax for assert?
If I look in the tests it's
Duns.number(100).assert;
But in the code
assert
is a function.Shouldn't the syntax be
Duns.assert(value, schema);
?