GitHub

DaffCategoryFactory

A factory for creating a DaffCategory.

import { DaffCategoryFactory } from '@daffodil/category/testing'
@Injectable()
class DaffCategoryFactory extends DaffModelFactory<DaffCategory, typeof MockCategory> {
  createTree(
    depth: number
    productIds: string[] = []
    partial: Partial<DaffCategory> = {}
  ): DaffCategory
}

Properties

Name Type Description
createTree DaffCategory

Creates a category tree of specified depth, optionally using the passed product IDs. This is very useful for creating a category tree that closely resembles those found in the wild. Each child has a minimum of half of the parent's products.