linnify / typeorm-factory

Typeorm factory that makes testing easier
ISC License
29 stars 9 forks source link

what about an "entity" field on my Entity ? #17

Open adrien-may opened 2 years ago

adrien-may commented 2 years ago

In Factory Boy, classes uses a class Meta to defined the model. With the implementation you made, we can't build a typeorm entity containing a field called "entity". Any plan to support it ?

dariusmb commented 2 years ago

@adrien-may We have the entity property on the Factory class as it is mentioned in the readme

export class NormalUserFactory extends Factory<User> {
  entity = User
}

Isn't this what you are looking for?

adrien-may commented 2 years ago

Hi there, I meant if a User model has an "entity" field, we cannot write:

export class UserFactory extends Factory<User> {
  //model
  entity = User;

  // fields
  entity = 'foo';