@@ -4,7 +4,7 @@ var expect = require('chai').expect
44describe ( 'async-validate:' , function ( ) {
55
66 var descriptor = {
7- mock : { type : 'function' } ,
7+ mock : { type : 'function' }
88 }
99
1010 it ( 'should error on value that is not a function' , function ( done ) {
@@ -18,7 +18,7 @@ describe('async-validate:', function() {
1818
1919 it ( 'should error on invalid arity (len: 1)' , function ( done ) {
2020 var descriptor = {
21- mock : { type : 'function' , len : 1 } ,
21+ mock : { type : 'function' , len : 1 }
2222 }
2323 var schema = new Schema ( descriptor ) ;
2424 schema . validate ( { mock : function ( ) { } } , function ( err , res ) {
@@ -32,7 +32,7 @@ describe('async-validate:', function() {
3232
3333 it ( 'should error on invalid arity (min: 1)' , function ( done ) {
3434 var descriptor = {
35- mock : { type : 'function' , min : 1 } ,
35+ mock : { type : 'function' , min : 1 }
3636 }
3737 var schema = new Schema ( descriptor ) ;
3838 schema . validate ( { mock : function ( ) { } } , function ( err , res ) {
@@ -45,10 +45,10 @@ describe('async-validate:', function() {
4545
4646 it ( 'should error on invalid arity (max: 0)' , function ( done ) {
4747 var descriptor = {
48- mock : { type : 'function' , max : 0 } ,
48+ mock : { type : 'function' , max : 0 }
4949 }
5050 var schema = new Schema ( descriptor ) ;
51- schema . validate ( { mock : function ( foo ) { } } , function ( err , res ) {
51+ schema . validate ( { mock : function ( foo ) { foo ( ) ; } } , function ( err , res ) {
5252 expect ( res . errors . length ) . to . eql ( 1 ) ;
5353 expect ( res . errors [ 0 ] . message ) . to . eql (
5454 'mock cannot have more than 0 arguments' ) ;
@@ -58,10 +58,12 @@ describe('async-validate:', function() {
5858
5959 it ( 'should error on invalid arity (min: 0, max: 1)' , function ( done ) {
6060 var descriptor = {
61- mock : { type : 'function' , min : 0 , max : 1 } ,
61+ mock : { type : 'function' , min : 0 , max : 1 }
6262 }
63- var schema = new Schema ( descriptor ) ;
64- schema . validate ( { mock : function ( foo , bar ) { } } , function ( err , res ) {
63+ var schema = new Schema ( descriptor )
64+ , source = { mock : function ( foo , bar ) { foo ( ) ; bar ( ) } } ;
65+
66+ schema . validate ( source , function ( err , res ) {
6567 expect ( res . errors . length ) . to . eql ( 1 ) ;
6668 expect ( res . errors [ 0 ] . message ) . to . eql (
6769 'mock must have arguments length between 0 and 1' ) ;
0 commit comments