Add factories

This commit is contained in:
Phan An 2017-12-16 22:13:45 +01:00
parent 0e85027668
commit 520807200f
3 changed files with 16 additions and 1 deletions

View file

@ -2,8 +2,10 @@ import artist from './artist'
import album from './album'
import song from './song'
import video from './video'
import playlist from './playlist'
import user from './user'
const models = { artist, album, song, video }
const models = { artist, album, song, video, playlist, user }
const factory = (model, count = 1, overrides = {}) => {
if (!(model in models)) {

View file

@ -0,0 +1,7 @@
import factory from '.'
export default () => ({
id: faker.random.number(),
name: faker.random.word(),
songs: factory('song', 10)
})

View file

@ -0,0 +1,6 @@
export default () => ({
id: faker.random.number(),
name: faker.name.findName(),
email: faker.internet.email(),
is_admin: false
})