async-validate
Advanced tools
Comparing version 0.13.2 to 1.0.0
{ | ||
"name": "async-validate", | ||
"description": "Asynchronous validation for node and the browser", | ||
"version": "0.13.2", | ||
"version": "1.0.0", | ||
"author": "muji <noop@xpm.io>", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
var email = require('../email') | ||
var email = require('../email') | ||
, schema = { | ||
@@ -3,0 +3,0 @@ type: 'object', |
@@ -24,4 +24,5 @@ var expect = require('chai').expect | ||
expect(res.errors.length).to.eql(1); | ||
expect(res.errors[0].message).to.eql( | ||
'instance is not an instance of function (anonymous)'); | ||
expect( | ||
/instance is not an instance of/.test(res.errors[0].message)) | ||
.to.eql(true) | ||
done(); | ||
@@ -28,0 +29,0 @@ }); |
var expect = require('chai').expect | ||
, Schema = require('../../index') | ||
, msg = require('../../messages') | ||
, override = require('../fixtures/schema/message-string-override'); | ||
, literal = require('../fixtures/schema/message-literal'); | ||
@@ -9,3 +9,3 @@ describe('async-validate:', function() { | ||
it('should validate using literal option', function(done) { | ||
var schema = new Schema(override); | ||
var schema = new Schema(literal); | ||
@@ -22,4 +22,5 @@ // clone of the default messages | ||
schema.validate({}, {literal: true}, function(err, res) { | ||
expect(res.errors.length).to.eql(1); | ||
expect(res.errors.length).to.eql(2); | ||
expect(res.errors[0].message).to.eql('REQUIRED !'); | ||
expect(res.errors[1].message).to.eql('REQUIRED ! job'); | ||
done(); | ||
@@ -26,0 +27,0 @@ }); |
@@ -5,2 +5,3 @@ var expect = require('chai').expect | ||
, descriptor = require('../fixtures/schema/multiple-rules') | ||
, source = require('../fixtures/schema/multiple-rules-source') | ||
, multi = require('../fixtures/schema/multiple-rules-function'); | ||
@@ -22,5 +23,6 @@ | ||
); | ||
it('should error on multiple validation rules for a field single failure', | ||
function(done) { | ||
var schema = new Schema(descriptor); | ||
var schema = new Schema(source); | ||
schema.validate({email: 'user@example'}, function(err, res) { | ||
@@ -27,0 +29,0 @@ expect(res.errors.length).to.eql(1); |
@@ -77,4 +77,4 @@ var expect = require('chai').expect | ||
schema.validate(source, function(err, res){ | ||
expect(err).to.be.null; | ||
expect(res).to.be.null; | ||
expect(err).to.eql(null); | ||
expect(res).to.eql(null); | ||
done(); | ||
@@ -99,4 +99,4 @@ }); | ||
schema.validate(source, function(err, res){ | ||
expect(err).to.be.null; | ||
expect(res).to.be.null; | ||
expect(err).to.eql(null); | ||
expect(res).to.eql(null); | ||
done(); | ||
@@ -110,3 +110,3 @@ }); | ||
function fn() { | ||
schema.validate(source, function(err, res){}); | ||
schema.validate(source, function(/*err, res*/){}); | ||
} | ||
@@ -126,4 +126,4 @@ expect(fn).throws(/Unknown performer type/i); | ||
schema.validate(source, function(err, res){ | ||
expect(err).to.be.null; | ||
expect(res).to.be.null; | ||
expect(err).to.eql(null); | ||
expect(res).to.eql(null); | ||
done(); | ||
@@ -130,0 +130,0 @@ }); |
@@ -22,18 +22,2 @@ var expect = require('chai').expect | ||
//it('should error on required string field (null)', function(done) { | ||
//var descriptor = { | ||
//type: 'object', | ||
//fields: { | ||
//name: {type: 'string', required: true} | ||
//} | ||
//} | ||
//var schema = new Schema(descriptor); | ||
//schema.validate({name: null}, function(err, res) { | ||
//expect(res.errors.length).to.eql(2); | ||
//expect(res.fields.name.length).to.eql(2); | ||
//expect(res.errors[0].message).to.eql('name is required'); | ||
//done(); | ||
//}); | ||
//}); | ||
it('should error on non-string type', function(done) { | ||
@@ -40,0 +24,0 @@ var descriptor = { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
218618
193
4625
1
3