import { factory } from 'factory-bot' import { datatype, date, internet, random } from 'faker' import { sample } from 'lodash' import { Video, VideoPlaylist, VideoPlaylistCarouselDirection } from '../../src/models' import { countryByCode } from '../../src/utils/countries' factory.define( 'video_playlist', VideoPlaylist, { id: datatype.uuid, title: random.word, carousel_direction: () => sample(Object.values(VideoPlaylistCarouselDirection)), order: () => datatype.number(10), country_code: () => sample(Object.keys(countryByCode)), }, VideoPlaylist, ) factory.define( 'video', Video, { id: datatype.uuid, title: random.word, thumb_url: internet.url, uploaded_at: () => date.past(1), description: random.words, featured: datatype.boolean, featured_main: datatype.boolean, country_code: () => sample(Object.keys(countryByCode)), playlist_id: datatype.uuid, }, Video, )