Socket
Socket
Sign inDemoInstall

factory-girl

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

factory-girl - npm Package Compare versions

Comparing version 5.0.0-beta.1 to 5.0.0

11

index.es6.js

@@ -296,6 +296,11 @@ import _slicedToArray from 'babel-runtime/helpers/slicedToArray';

case 0:
_context5.next = 2;
if (Array.isArray(num)) {
buildOptionsArray = attrsArray;
attrsArray = num;
num = attrsArray.length;
}
_context5.next = 3;
return this.buildMany(adapter, num, attrsArray, buildOptionsArray);
case 2:
case 3:
models = _context5.sent;

@@ -311,3 +316,3 @@ savedModels = models.map(function (model) {

case 5:
case 6:
case 'end':

@@ -314,0 +319,0 @@ return _context5.stop();

@@ -302,6 +302,11 @@ 'use strict';

case 0:
_context5.next = 2;
if (Array.isArray(num)) {
buildOptionsArray = attrsArray;
attrsArray = num;
num = attrsArray.length;
}
_context5.next = 3;
return this.buildMany(adapter, num, attrsArray, buildOptionsArray);
case 2:
case 3:
models = _context5.sent;

@@ -317,3 +322,3 @@ savedModels = models.map(function (model) {

case 5:
case 6:
case 'end':

@@ -320,0 +325,0 @@ return _context5.stop();

@@ -302,6 +302,11 @@ (function (global, factory) {

case 0:
_context5.next = 2;
if (Array.isArray(num)) {
buildOptionsArray = attrsArray;
attrsArray = num;
num = attrsArray.length;
}
_context5.next = 3;
return this.buildMany(adapter, num, attrsArray, buildOptionsArray);
case 2:
case 3:
models = _context5.sent;

@@ -317,3 +322,3 @@ savedModels = models.map(function (model) {

case 5:
case 6:
case 'end':

@@ -320,0 +325,0 @@ return _context5.stop();

@@ -9,3 +9,3 @@ {

],
"version": "5.0.0-beta.1",
"version": "5.0.0",
"keywords": [

@@ -12,0 +12,0 @@ "factory",

@@ -142,2 +142,19 @@ # factory-girl

### Extending Factories
You can extend a factory using `#extend`:
```js
factory.define('user', User, { username: 'Bob', expired: false });
factory.extend('user', 'expiredUser', { expired: true });
factory.build('expiredUser').then(user => {
console.log(user); // => User { username: 'Bob', expired: true });
});
```
### `#extend(parent, name, initializer, options = {})`
The `#extend` method takes the same options as `#define` except you
can provide a different `Model` using `options.model`.
## Using Factories

@@ -206,2 +223,4 @@

### Factory#createMany(name, num, attrs, buildOptions = {})
The createMany version creates an array of model instances.

@@ -216,4 +235,10 @@

Similar to `Factory#attrs` and `Factory#build`, you can pass `attrs` to override and
`buildOptions`.
`buildOptions`. If you pass an array of `attrs` then each element of the array will be
used as the attrs for a each model created.
### Factory#createMany(name, attrs, buildOptions = {})
If you can pass an array of `attrs` then you can omit `num` and the length of the array
will be used.
### Factory#cleanUp

@@ -231,4 +256,5 @@

```javascript
const factory = require('factory-girl').factory;
const adapter = new factoryGirl.MongooseAdapter();
const FactoryGirl = require('factory-girl');
const factory = FactoryGirl.factory;
const adapter = new FactoryGirl.MongooseAdapter();

@@ -235,0 +261,0 @@ // use the mongoose adapter as the default adapter

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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