I am trying to test validation on a very simple mongoose model, but I have some problem with exceptions.//model.jsvar ResourceDef = new Schema({name: {type: String, required: true},content: String,});var Resource = mongoose.model('Resources', ResourceDef);//test.jsvows.describe('test model behavior').addBatch({'validating a Resource object with name equals to null': {topic: function() {new model.Resource({name: null,content: '.....',}).validate(this.callback);},'should throw an error': function(e) {assert.ok(e);}}}).export(module);I get this error:validating a Resource object with name equals to null✗ should throw an error» An unexpected error was caught: ValidationError: Validator "required" failed for path nameI don't understand why mongoose is throwing that ValidationError!
I was just having this exact issue the other day, thanks for the catch Papandreou! You just saved me some serious time.
-Chad
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en