btrz-mongo-factory
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -44,3 +44,3 @@ "use strict"; | ||
while(x < qty) { | ||
let model = schemaFaker(schema, references); | ||
let model = schemaFaker.generate(schema, references); | ||
if (Array.isArray(overrides)) { | ||
@@ -106,3 +106,4 @@ let index = x; | ||
let overrides = options || {}; | ||
let model = modelGen(this.fixtures(modelName), 1, overrides, references).next().value; | ||
const schema = this.fixtures(modelName) || references[0]; | ||
let model = modelGen(schema, 1, overrides, references).next().value; | ||
return this.connection | ||
@@ -121,3 +122,4 @@ .then((db) => { | ||
let models = []; | ||
for (let model of modelGen(this.fixtures(modelName), qty, overrides, references)) { | ||
const schema = this.fixtures(modelName) || references[0]; | ||
for (let model of modelGen(schema, qty, overrides, references)) { | ||
models.push(model); | ||
@@ -124,0 +126,0 @@ } |
{ | ||
"name": "btrz-mongo-factory", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "\"A factory to create data in a mongoDb using chance and Json-Schema\"", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -113,2 +113,16 @@ /*jshint expr: true*/ | ||
it("should create an object with an schema and a $ref", function (done) { | ||
factory.create("account_two", {}, [factory.fixtures("account"), factory.fixtures("tags")]).then(function (model) { | ||
try { | ||
expect(model.name).to.not.be.undefined; | ||
expect(model.tags.length).to.not.be.eql(0); | ||
expect(model.tags[0].id).to.not.be.undefined; | ||
expect(model.tags[0].name).to.not.be.undefined; | ||
done(); | ||
} catch(err) { | ||
done(err); | ||
} | ||
}); | ||
}); | ||
it("should throw if references is not an array", function () { | ||
@@ -115,0 +129,0 @@ function sut() { |
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
22239
494