Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make argument of Factory.build() to be optional #1

Closed
vunguyenhung opened this issue Aug 19, 2017 · 0 comments
Closed

Make argument of Factory.build() to be optional #1

vunguyenhung opened this issue Aug 19, 2017 · 0 comments

Comments

@vunguyenhung
Copy link
Contributor

Hi,
Firstly, this is a very useful package. I usually use this with Faker.js to create fake data, for example:

// todo.factory.ts
export const TodoFactory = Factory.makeFactory<Todo>({
    content: faker.lorem.words(7),
    completed: faker.random.boolean()
});
// todo.seed.ts
const todo = TodoFactory.build({}); // pass empty object to build a Todo with default field.
export const seedTodos = () => TodoModel.create(todo); // pass created Todo to Mongoose model create()

So, when using this with Faker.js, the needs to define override field on Factory.build() is sometimes redundant. Therefore I think it's better to make the argument of build() todo optional.

willryan pushed a commit that referenced this issue Feb 23, 2019
…e_default_value

Issue #13. Allow null to override default value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant