Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-validate

Package Overview
Dependencies
Maintainers
2
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-validate - npm Package Compare versions

Comparing version 0.13.2 to 1.0.0

test/fixtures/schema/message-literal.js

2

package.json
{
"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 = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc