har-validator
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"name": "har-validator", | ||
"description": "HTTP Archive (HAR) validator using JSON Schema", | ||
"description": "Extremely fast HTTP Archive (HAR) validator using JSON Schema", | ||
"author": "Ahmad Nassri <ahmad@ahmadnassri.com> (https://www.ahmadnassri.com/)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -7,8 +7,8 @@ 'use strict'; | ||
module.exports = function (data, cb) { | ||
if (!data) { | ||
return false; | ||
var valid = false; | ||
if (data !== undefined) { | ||
// execute is-my-json-valid | ||
valid = validate(data); | ||
} | ||
// execute is-my-json-valid | ||
var valid = validate(data); | ||
@@ -15,0 +15,0 @@ // callback? |
@@ -13,7 +13,8 @@ 'use strict'; | ||
err[0].should.have.property('message'); | ||
err[0].message.should.equal('is required'); | ||
err[0].should.have.property('field').and.equal('data.log'); | ||
err[0].should.have.property('message').and.equal('is required'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -25,7 +26,7 @@ | ||
err[0].should.have.property('message'); | ||
err[0].message.should.equal('is the wrong type'); | ||
err[0].should.have.property('field').and.equal('data'); | ||
err[0].should.have.property('message').and.equal('is the wrong type'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -36,5 +37,5 @@ | ||
valid.should.be.false; | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -44,7 +45,8 @@ | ||
validate(fixtures.invalid.version, function (err, valid) { | ||
err[0].field.should.equal('data.log.version'); | ||
err[0].message.should.equal('is the wrong type'); | ||
err[0].should.have.property('field').and.equal('data.log.version'); | ||
err[0].should.have.property('message').and.equal('is the wrong type'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
@@ -54,15 +56,19 @@ | ||
validate(fixtures.invalid.creator, function (err, valid) { | ||
err[0].should.have.property('message'); | ||
err[0].message.should.equal('referenced schema does not match'); | ||
err[0].should.have.property('field').and.equal('data.log.creator'); | ||
err[0].should.have.property('message').and.equal('referenced schema does not match'); | ||
done(); | ||
}); | ||
done(); | ||
}); | ||
it('should not fail with full example', function () { | ||
it('should not fail with full example', function (done) { | ||
validate(fixtures.valid, function (err, valid) { | ||
valid.should.be.true; | ||
should.not.exist(err); | ||
valid.should.be.true; | ||
done(); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17565
418