btrz-mongo-factory
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -44,3 +44,8 @@ "use strict"; | ||
while(x < qty) { | ||
let model = schemaFaker.generate(schema, references); | ||
let model = {}; | ||
try { | ||
model = schemaFaker.generate(schema, references); | ||
} catch (e) { | ||
model = {}; | ||
} | ||
if (Array.isArray(overrides)) { | ||
@@ -59,2 +64,3 @@ let index = x; | ||
} catch(e) { | ||
console.log(e); | ||
throw new Error("There was a problem with the references array, make sure it contains a valid json-schemas: " + e); | ||
@@ -61,0 +67,0 @@ } |
{ | ||
"name": "btrz-mongo-factory", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "\"A factory to create data in a mongoDb using chance and Json-Schema\"", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -133,16 +133,2 @@ /*jshint expr: true*/ | ||
}); | ||
it("should throw if references contains undefined", function () { | ||
function sut() { | ||
factory.create("account", {}, [undefined]); | ||
} | ||
expect(sut).to.throw("There was a problem with the references array, make sure it contains a valid json-schemas: TypeError: Cannot read property '$id' of undefined"); | ||
}); | ||
it("should throw is references contains null", function () { | ||
function sut() { | ||
factory.create("account", {}, [null]); | ||
} | ||
expect(sut).to.throw("There was a problem with the references array, make sure it contains a valid json-schemas: TypeError: Cannot read property '$id' of null"); | ||
}); | ||
}); | ||
@@ -149,0 +135,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
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
21684
488