I have to validate this function :
UserSchema.path('firstname').validate(function (firstname) {
validate
if (!this.provider) return true;
return (typeof firstname === 'String' && firstname.length > 0);
}, 'First Name cannot be blank');
I wrote my unit test case like this :
it("ValidateFirstname",function(done){
validator.validateFirstname('sample').should.equal(false);
done();
});
i getting String is not a function error. I have to test this condition as unit or function testing?
Aucun commentaire:
Enregistrer un commentaire