GitHub

MockCompositeProductItem

Mocked DaffCompositeProductItem object.

import { MockCompositeProductItem } from '@daffodil/product-composite/testing'
class MockCompositeProductItem implements DaffCompositeProductItem {
  id: faker.datatype.uuid()
  url: `/${faker.internet.domainWord()}.html`
  required: faker.datatype.boolean()
  title: faker.commerce.productName()
  input_type: DaffCompositeProductItemInputEnum.select
  options: [
      this.optionFactory.create({
          is_default: true
      }),
      this.optionFactory.create({
          is_default: false
      }),
  ]
  protected optionFactory: DaffCompositeProductItemOptionFactory
}

Properties

Name Type Description
id faker.datatype.uuid()
url `/${faker.internet.domainWord()}.html`
required faker.datatype.boolean()
title faker.commerce.productName()
input_type DaffCompositeProductItemInputEnum.select
options [ this.optionFactory.create({ is_default: true }), this.optionFactory.create({ is_default: false }), ]
optionFactory DaffCompositeProductItemOptionFactory