@dadi/autodata

1.0.0 • Public • Published

DADI API Autodata

Generate test data based on DADI API collection schemas

npm (scoped) coverage JavaScript Style Guide

Overview

Install

$ npm install @dadi/autodata --save-dev

Usage

var autodata = require('@dadi/autodata')
autodata.loadCollections(path.join(__dirname, '../workspace/collections'))

return autodata.create('book').then((fixture) => {
  console.log(fixture)
})

return autodata.createListOf('people', 2).then((fixture) => {
  console.log(fixture)
})

Test Data Formatters

address

Type Format Example
zipCode {{address.zipCode}} 77497-0357
city {{address.city}} West Osbornebury
cityPrefix {{address.cityPrefix}} South
citySuffix {{address.citySuffix}} stad
streetName {{address.streetName}} Marquardt Run
streetAddress {{address.streetAddress}} 500 Wilkinson Trail
streetSuffix {{address.streetSuffix}} Roads
streetPrefix {{address.streetPrefix}} a
secondaryAddress {{address.secondaryAddress}} Suite 883
county {{address.county}} Cambridgeshire
country {{address.country}} Oman
countryCode {{address.countryCode}} AL
state {{address.state}} Arizona
stateAbbr {{address.stateAbbr}} NH
latitude {{address.latitude}} -48.3898
longitude {{address.longitude}} 164.8184

commerce

Type Format Example
color {{commerce.color}} pink
department {{commerce.department}} Toys
productName {{commerce.productName}} Awesome Concrete Tuna
price {{commerce.price}} 768.00
productAdjective {{commerce.productAdjective}} Licensed
productMaterial {{commerce.productMaterial}} Wooden
product {{commerce.product}} Soap

company

Type Format Example
suffixes {{company.suffixes}} ["Inc", "and Sons", "LLC", "Group"]
companyName {{company.companyName}} Cole - Tremblay
companySuffix {{company.companySuffix}} and Sons
catchPhrase {{company.catchPhrase}} Profit-focused background Graphical User Interface
bs {{company.bs}} customized grow channels
catchPhraseAdjective {{company.catchPhraseAdjective}} Innovative
catchPhraseDescriptor {{company.catchPhraseDescriptor}} analyzing
catchPhraseNoun {{company.catchPhraseNoun}} core
bsAdjective {{company.bsAdjective}} seamless
bsBuzz {{company.bsBuzz}} embrace
bsNoun {{company.bsNoun}} mindshare

date

Type Format Example
past {{date.past}} Tue Dec 08 2015 18:26:08 GMT+1100 (AEDT)
future {{date.future}} Wed Jan 11 2017 13:43:40 GMT+1100 (AEDT)
between {{date.between}} Invalid Date
recent {{date.recent}} Thu Aug 18 2016 06:54:06 GMT+1000 (AEST)
month {{date.month}} January
weekday {{date.weekday}} Friday

finance

Type Format Example
account {{finance.account}} 42448607
accountName {{finance.accountName}} Money Market Account
mask {{finance.mask}} 7674
amount {{finance.amount}} 555.00
transactionType {{finance.transactionType}} payment
currencyCode {{finance.currencyCode}} RSD
currencyName {{finance.currencyName}} Moroccan Dirham
currencySymbol {{finance.currencySymbol}} Php
bitcoinAddress {{finance.bitcoinAddress}} 1ZGMT2RNR85BN3AWJIET7QR6SFJGNLVS

hacker

Type Format Example
abbreviation {{hacker.abbreviation}} COM
adjective {{hacker.adjective}} multi-byte
noun {{hacker.noun}} sensor
verb {{hacker.verb}} input
ingverb {{hacker.ingverb}} navigating
phrase {{hacker.phrase}} generating the port won't do anything, we need to transmit the haptic IB bandwidth!

image

Type Format Example
image {{image.image}} http://lorempixel.com/640/480/city
avatar {{image.avatar}} https://s3.amazonaws.com/uifaces/faces/twitter/ceekaytweet/128.jpg
imageUrl {{image.imageUrl}} http://lorempixel.com/640/480
abstract {{image.abstract}} http://lorempixel.com/640/480/abstract
animals {{image.animals}} http://lorempixel.com/640/480/animals
business {{image.business}} http://lorempixel.com/640/480/business
cats {{image.cats}} http://lorempixel.com/640/480/cats
city {{image.city}} http://lorempixel.com/640/480/city
food {{image.food}} http://lorempixel.com/640/480/food
nightlife {{image.nightlife}} http://lorempixel.com/640/480/nightlife
fashion {{image.fashion}} http://lorempixel.com/640/480/fashion
people {{image.people}} http://lorempixel.com/640/480/people
nature {{image.nature}} http://lorempixel.com/640/480/nature
sports {{image.sports}} http://lorempixel.com/640/480/sports
technics {{image.technics}} http://lorempixel.com/640/480/technics
transport {{image.transport}} http://lorempixel.com/640/480/transport

internet

Type Format Example
avatar {{internet.avatar}} https://s3.amazonaws.com/uifaces/faces/twitter/brunodesign1206/128.jpg
email {{internet.email}} Lavinia.Torp@hotmail.com
exampleEmail {{internet.exampleEmail}} Eda99@example.net
userName {{internet.userName}} Carmine_Gerhold46
protocol {{internet.protocol}} https
url {{internet.url}} http://dewayne.name
domainName {{internet.domainName}} marlee.com
domainSuffix {{internet.domainSuffix}} org
domainWord {{internet.domainWord}} jimmie
ip {{internet.ip}} 181.124.202.82
userAgent {{internet.userAgent}} "Mozilla/5.0 (Windows; U; Windows NT 6.2) AppleWebKit/538.2.0 (KHTML, like Gecko) Chrome/19.0.810.0 Safari/538.2.0"
color {{internet.color}} #3e6c6e
mac {{internet.mac}} 9d:26:a6:ae:da:91
password {{internet.password}} 2Dv2UnQECH7cRye

lorem

Type Format Example
word {{lorem.word}} maxime
words {{lorem.words}} vitae quia provident
sentence {{lorem.sentence}} Odio eos delectus velit non ut nihil molestiae nisi aut.
sentences {{lorem.sentences}} Molestiae quis iure eligendi incidunt ad ipsum. Neque at dolore. Voluptatibus consequatur perspiciatis et aliquid laudantium. Adipisci eius odit.
paragraph {{lorem.paragraph}} Ut corrupti aut illo eos similique modi tempore ea. Dolores eaque quas exercitationem tempore numquam et. Porro qui et adipisci magnam tenetur voluptatem dolorum. Assumenda dolor minima animi inventore facilis minima. Vel debitis dolore molestias quos vel eos omnis. Labore et explicabo quaerat.
paragraphs {{lorem.paragraphs}} Vel veritatis perspiciatis vel in. Ad provident fugit velit cupiditate ut. Numquam qui error neque odio asperiores illum occaecati. Voluptas aut nisi quod maxime fuga a ad fugit facere. Eaque magnam minus mollitia mollitia et excepturi amet.\n \rVeritatis error quo repellat et. Error est eius rerum neque aliquid optio qui pariatur recusandae. Adipisci et vitae voluptatum pariatur enim error.\n \rExplicabo quidem laborum. Quod voluptas perspiciatis aliquid. Explicabo error sunt at illum perspiciatis veritatis totam consequatur nam.
text {{lorem.text}} sit
lines {{lorem.lines}} Suscipit aliquam sit nemo commodi incidunt.\nEum excepturi aliquid nisi et.\nDistinctio quaerat ut ea fuga eius rerum cum alias ut.\nAutem possimus a eum officia.

name

Type Format Example
firstName {{name.firstName}} Ernestina
lastName {{name.lastName}} McCullough
findName {{name.findName}} Adah Blanda
jobTitle {{name.jobTitle}} Corporate Usability Designer
prefix {{name.prefix}} Dr.
suffix {{name.suffix}} I
title {{name.title}} International Configuration Manager
jobDescriptor {{name.jobDescriptor}} Human
jobArea {{name.jobArea}} Operations
jobType {{name.jobType}} Executive

phone

Type Format Example
phoneNumber {{phone.phoneNumber}} (808) 286-5628
phoneNumberFormat {{phone.phoneNumberFormat}} 040-026-8581
phoneFormats {{phone.phoneFormats}} (####) ####-#####

random

Type Format Example
number {{random.number}} 94343
arrayElement {{random.arrayElement}} a
objectElement {{random.objectElement}} bar
uuid {{random.uuid}} b7231381-ab1b-4704-81d8-c8a0763544af
boolean {{random.boolean}} TRUE
word {{random.word}} Concrete
words {{random.words}} web-enabled Central
image {{random.image}} http://lorempixel.com/640/480/technics
locale {{random.locale}} it
alphaNumeric {{random.alphaNumeric}} 2

system

Type Format Example
fileName {{system.fileName}} multi_state.nml
commonFileName {{system.commonFileName}} matrix_human.mp2
mimeType {{system.mimeType}} application/vnd.dm.delegation+xml
commonFileType {{system.commonFileType}} image
commonFileExt {{system.commonFileExt}} mp4
fileType {{system.fileType}} message
fileExt {{system.fileExt}} wmz
directoryPath {{system.directoryPath}} undefined
filePath {{system.filePath}} undefined
semver {{system.semver}} 4.0.1

Readme

Keywords

none

Package Sidebar

Install

npm i @dadi/autodata

Weekly Downloads

1

Version

1.0.0

License

ISC

Last publish

Collaborators

  • annybs
  • josephdenne
  • jimlambie
  • adamkdean