@truffle/contract-schema
Advanced tools
Comparing version 3.4.3 to 3.4.4
@@ -15,3 +15,3 @@ { | ||
}, | ||
"version": "3.4.3", | ||
"version": "3.4.4", | ||
"main": "index.js", | ||
@@ -46,3 +46,3 @@ "directories": { | ||
}, | ||
"gitHead": "dee904b194cfb391b4cf2ed470dc596a2d503898" | ||
"gitHead": "653686708545be12b71f9b35eb7a3ca66510c54d" | ||
} |
@@ -1,13 +0,13 @@ | ||
var Schema = require("../index.js"); | ||
var assert = require("assert"); | ||
const Schema = require("../index.js"); | ||
const assert = require("assert"); | ||
var MetaCoin = require("./MetaCoin.json"); | ||
const MetaCoin = require("./MetaCoin.json"); | ||
describe("Schema", function() { | ||
it("validates correct input", function() { | ||
describe("Schema", function () { | ||
it("validates correct input", function () { | ||
Schema.validate(MetaCoin); | ||
}); | ||
it("throws exception on invalid input", function() { | ||
var invalid = { | ||
it("throws exception on invalid input", function () { | ||
const invalid = { | ||
abi: -1 | ||
@@ -18,9 +18,38 @@ }; | ||
Schema.validate(invalid); | ||
assert(false); | ||
} catch (err) { | ||
var abiErrors = err.errors.filter(function(error) { | ||
const abiErrors = err.errors.filter(function (error) { | ||
return error.dataPath === ".abi"; | ||
}); | ||
assert(abiErrors); | ||
assert(abiErrors.length > 0); | ||
} | ||
}); | ||
it("validates a correct input as part of normalization", function () { | ||
Schema.normalize(MetaCoin, { | ||
validate: true | ||
}); | ||
}); | ||
it("throws exception when attempting to validate invalid input during normalization", function () { | ||
const invalid = { | ||
abi: -1 | ||
}; | ||
try { | ||
Schema.normalize(invalid, { | ||
validate: true | ||
}); | ||
assert(false); | ||
} catch (err) { | ||
const abiErrors = err.errors.filter(function (error) { | ||
return error.dataPath === ".abi"; | ||
}); | ||
assert(abiErrors.length > 0); | ||
} | ||
}); | ||
}); |
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
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
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
277115
6839
1