sghribi / loopback-fixtures

ISC License
18 stars 21 forks source link

loopback-fixtures

Expressive fixtures generator for Loopback

build status dependency status

Installation

Basic usage

npm install --save loopback-fixtures

Then, in your server/component-config.json, add :

{
  "loopback-fixtures": {
    "fixturePath": "/fixtures/data/",
    "append": false,
    "autoLoad": false
  }
}

Write your YML fixture file /fixture/data/data.yml (adapt according your model) :

Group:
  group{1..10}:
    name: "Groupe {@} depuis les fixtures"

User:
  user{1..10}:
    name: "User {@} : {{name.lastName}}"
    groupId: @group{@}
    email: "{{internet.email}}"
    birthDate: "2016-01-01"
    favoriteNumber: "(function() { return Math.round(Math.random()*1000);})()"

How to load fixtures ?

Configuration options

Features

Credits

Samy Ghribi

License

ISC