Created
August 1, 2021 06:43
-
-
Save Goldziher/655dd93b1b297e5764054bb6f9cc6a2a to your computer and use it in GitHub Desktop.
Example UserDTO factory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as faker from 'faker'; | |
import { FixtureFactory } from 'interface-forge'; | |
import { UserDTO } from '@shared/dto/User.dto'; | |
export const UserDTOFactory = new FixtureFactory<UserDTO>(() => ({ | |
id: faker.datatype.uuid(), | |
firstName: faker.name.firstName(), | |
lastName: faker.name.lastName(), | |
isActive: true, | |
email: faker.internet.email(), | |
location: faker.address.city(), | |
employer: faker.company.companyName(), | |
profession: TypeFactory.iterate([ | |
'Chef', | |
'Programmer', | |
'Fighter Pilot', | |
'Slob', | |
]), | |
phoneNumber: faker.phone.phoneNumber(), | |
imageUrl: faker.internet.url(), | |
birthDate: faker.date.past(faker.datatype.number({ min: 20, max: 80 })), | |
})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment