Skip to content

The override params with association fields is not working properly #247

Description

@kevin-nguyen-goldenowl

Here’s is my case.

  • Expectation: Create a comment with the existing post

  • Reality: Create a comment with the existing post and create a random post from the comment factory

  • Post factory

Image
  • Comment factory
Image
const existingPost = await factory(Post)().create();
const comment = await factory(Comment)().create({post: existingPost});

When I pass the existing post via the override params, it will attach the existing post to the comment, but the comment always creates a random post by default, which I don’t want. I think we should check if the override params don’t contain the association, then create the default; that will make sense.

Can anyone help me on this? Thank you

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions