Skip to content

Instantly share code, notes, and snippets.

@HonzaMac
Created December 28, 2021 20:47
Show Gist options
  • Save HonzaMac/ea0bc0ba1e0f7926b6a44eea992b64ef to your computer and use it in GitHub Desktop.
Save HonzaMac/ea0bc0ba1e0f7926b6a44eea992b64ef to your computer and use it in GitHub Desktop.
createUser with fake data
import * as faker from "faker"
import { User } from "../../src/userService"
export const createUser = (data: Partial<User> = {}) => {
const fakeData: User = {
username: faker.name.findName(),
email: faker.internet.email(),
country: faker.address.country(),
department: faker.company.companyName(),
divisionName: faker.name.jobArea(),
}
return {
id: 'e2f5a82a-3f2e-4b6d-b4d2-086afaa08f8a',
...fakeData,
...data,
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment