GitHub

DaffCategoryFactory

import { DaffCategoryFactory } from '@daffodil/category/testing'

A factory for creating a DaffCategory.

@Injectable()
class DaffCategoryFactory extends DaffModelFactory<DaffCategory, typeof MockCategory> {
  createTree(
    depth: number
    productIds: string[] = []
    partial: Partial<DaffCategory> = {}
  ): DaffCategory
}

() Methods

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.

Parameters
Parameterdepth: number
Description
ParameterproductIds: string[]
Default[]
Description
Parameterpartial: Partial<DaffCategory>
Default{}
Description