import faker from 'faker';
import type * as Types from './types';
export function Person(overwrites: Partial<Types.Person> = {}): Types.Person {
return {
email: faker.internet.email(),
firstName: faker.name.firstName(),
...overwrites
}
}
export function Family(overwrites: Partial<Types.Family> = {}): Types.Family {
return {
name: faker.name.lastName(),
members: Array.from({ length: faker.random.number(8) }).map(() => Person()),
...overwrites
}
}
I guess supporting exactly this would be to specific for this library and possibly extend its scope but a intermediate step would be to support a "raw" outputFormat like this
When using mock data in tests I would like to
From this:
To this:
I guess supporting exactly this would be to specific for this library and possibly extend its scope but a intermediate step would be to support a "raw" outputFormat like this
which could then be used to create such factories.
What's your opinion on this? If it sounds interesting, I'd like to create a PR.