text: import faker from 'faker';
  
  import models from 'server/models';
  
  /**
   * Generate an object which contains attributes needed
   * to successfully create a user instance.
   *
   * @param  {Object} props Properties to use for the user.
   *
   * @return {Object}       An object to build the user from.
   */
  const data = async (props = {}) => {
    const defaultProps = {
      id: faker.random.number(),
      email: faker.internet.email(),
      name: faker.name.firstName() + faker.name.lastName(),
      dateOfBirth: faker.date.past(),
    };
  
    return Object.assign({}, defaultProps, props);
  };
  
  /**
   * Generates a user instance from the properties provided.
   *
   * @param  {Object} props Properties to use for the user.
   *
   * @return {Object}       A user instance
   */
  export default async (props = {}) =>
    models.User.create(await data(props));
  