mirror of
https://github.com/koel/koel
synced 2024-11-10 14:44:13 +00:00
Add factories
This commit is contained in:
parent
0e85027668
commit
520807200f
3 changed files with 16 additions and 1 deletions
|
@ -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)) {
|
||||
|
|
7
resources/assets/js/tests/factory/playlist.js
Normal file
7
resources/assets/js/tests/factory/playlist.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import factory from '.'
|
||||
|
||||
export default () => ({
|
||||
id: faker.random.number(),
|
||||
name: faker.random.word(),
|
||||
songs: factory('song', 10)
|
||||
})
|
6
resources/assets/js/tests/factory/user.js
Normal file
6
resources/assets/js/tests/factory/user.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default () => ({
|
||||
id: faker.random.number(),
|
||||
name: faker.name.findName(),
|
||||
email: faker.internet.email(),
|
||||
is_admin: false
|
||||
})
|
Loading…
Reference in a new issue