1.5.1 • Published 1 month ago

efate-faker v1.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

efate-faker

Use the faker library to populate property values

Usage

Install the extension and pass the interface and function to createFixtureFactory

import { createFixtureFactory } from 'efate';
import { FakerExtension, fakerExtension } from 'efate-faker';
const createFixture = createFixtureFactory<FakerExtension>(fakerExtension);

This exposes a faker() function that accepts a function as parameter to specify which faker methods you want to use. The incremement value is also passed to the callback function if you want to use it.

interface User {
  firstName: string;
  userName: string;
}
const userFixture = createFixture<User>((t) => {
  t.firstName.faker((faker, increment) => faker.name.firstName());
  t.userName.faker((faker, increment) => faker.internet.userName());
});

Todo

This is the first pass at the this extension and really was the quickest way to implement it. It would be nice not to have to relay on the callback function. Also, currently the Faker object doesn't accept the option parameters, so its behavior can't be modified yet.

1.5.1

1 month ago

1.4.2

1 month ago

1.5.0

1 year ago

1.4.1

1 year ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago