An open API service indexing awesome lists of open source software.

https://github.com/bugthesystem/autopoco.js

Simple test data creator
https://github.com/bugthesystem/autopoco.js

Last synced: 7 months ago
JSON representation

Simple test data creator

Awesome Lists containing this project

README

          

# autopoco.js

[![Build Status](https://travis-ci.org/ziyasal/autopoco.js.svg?branch=master)](https://travis-ci.org/ziyasal/autopoco.js) [![Coverage Status](https://coveralls.io/repos/github/ziyasal/autopoco.js/badge.svg?branch=master)](https://coveralls.io/github/ziyasal/autopoco.js?branch=master)

**Install**

```sh
npm install autopoco.js
```

**ES6**
```js
import autopoco from 'autopoco.js'

let fixture = autopoco()

fixture.define('UserModel', {
name: fixture.fakes.String,
lastName: fixture.fakes.String,
age: fixture.fakes.Number,
email: fixture.fakes.Email,
phone: fixture.fakes.Phone
})

let userList = fixture.for('UserModel').createMany() //creates 3 item by default

for (let user of userList) {
console.log(JSON.stringify(user))
}
```

**CommonJS**
```js
const autopoco = require('autopoco.js')
const fixture = autopoco.default()

fixture.define('UserModel', {
name: fixture.fakes.String,
lastName: fixture.fakes.String,
age: fixture.fakes.Number,
email: fixture.fakes.Email,
phone: fixture.fakes.Phone
})

var userList = fixture.for('UserModel').createMany() //creates 3 item by default

for (var i=0; i