Skip to content

Commit

Permalink
edge case when there's no input
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Oct 7, 2014
1 parent 351bade commit 9ff16d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 8 additions & 8 deletions parambulator.js
Expand Up @@ -583,15 +583,15 @@
}

var err = new Error( msg )
err.parambulator = {
code:code,
property:ctxt.prop,
value:ctxt.point,
expected:ctxt.rule.spec,

parents:ctxt.parents,
point:ctxt.point,
rule:ctxt.rule}
err.parambulator = {
code: code,
property: ctxt.prop,
value: ctxt.point,
expected: (ctxt.rule ? ctxt.rule.spec : void 0),
parents: ctxt.parents,
point: ctxt.point,
rule: ctxt.rule}

return cb(err)
}
Expand Down
7 changes: 7 additions & 0 deletions test/parambulator.spec.js
Expand Up @@ -59,6 +59,13 @@ describe('parambulator', function() {
})


it('no_input', function() {
pb.validate(void 0,function(err){
assert.equal('no_input$',err.parambulator.code)
})
})


it('required$', function() {
pb.validate({a:1,z:1,red:1,foo:1,bar:1},function(err,res){
assert.isNull(err)
Expand Down

0 comments on commit 9ff16d8

Please sign in to comment.