Skip to content

Commit

Permalink
Merge pull request #335 from Quramy/feature/enhance_list_sig
Browse files Browse the repository at this point in the history
feature/enhance list sig
  • Loading branch information
Quramy authored Jun 19, 2024
2 parents a20693d + 3a2b9b2 commit 47333b8
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 85 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ await UserFactory.createList(3);
await Promise.all([0, 1, 2].map(() => UserFactory.create()));
```

The 2nd argument(optional) accepts an object which is assignable to `Partial<Prisma.UserCreateInput>` :

```ts
await UserFactory.createList(3, { name: "Bob" });
```

You can also pass list data assignable to `Partial<Prisma.UserCreateInput>[]` :

```ts
Expand Down
30 changes: 20 additions & 10 deletions examples/example-prj/src/__generated__/fabbrica/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions examples/example-prj/src/__generated__/fabbrica/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/example-prj/src/transient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const UserFactory = defineUserFactory.withTransientFields({
loginCount: 0,
})({
onAfterCreate: async (user, { loginCount }) => {
await LoginLogFactory.createList([...new Array(loginCount).keys()].map(() => ({ userId: user.id })));
await LoginLogFactory.createList(loginCount, { userId: user.id });
},
});

Expand Down
Loading

0 comments on commit 47333b8

Please sign in to comment.