Skip to main content
Version: 6.4

abstractFactory <T>

Index

Constructors

constructor

Properties

abstractreadonlymodel

model: Constructor<T>

Methods

create

  • create(amount: number, overrideParameters?: EntityData<T>): Promise<T[]>
  • Create (and flush) multiple entities


    Parameters

    • amount: number

      Number of entities that should be generated

    • optionaloverrideParameters: EntityData<T>

      Object specifying what default attributes of the entity factory should be overridden

    Returns Promise<T[]>

createOne

  • createOne(overrideParameters?: EntityData<T>): Promise<T>
  • Create (and flush) a single entity


    Parameters

    • optionaloverrideParameters: EntityData<T>

      Object specifying what default attributes of the entity factory should be overridden

    Returns Promise<T>

each

  • each(eachFunction: (entity: T) => void): Factory<T>
  • Set a function that is applied to each entity before it is returned In case of createOne or create it is applied before the entity is persisted


    Parameters

    • eachFunction: (entity: T) => void

      The function that is applied on every entity

      Returns Factory<T>

    make

    • make(amount: number, overrideParameters?: EntityData<T>): T[]
    • Make multiple entities and then persist them (not flush)


      Parameters

      • amount: number

        Number of entities that should be generated

      • optionaloverrideParameters: EntityData<T>

        Object specifying what default attributes of the entity factory should be overridden

      Returns T[]

    makeEntity

    • Make a single entity instance, without persisting it.


      Parameters

      • optionaloverrideParameters: EntityData<T>

        Object specifying what default attributes of the entity factory should be overridden

      Returns T

    makeOne

    • Make a single entity and persist (not flush)


      Parameters

      • optionaloverrideParameters: EntityData<T>

        Object specifying what default attributes of the entity factory should be overridden

      Returns T