GitHub

MockMagentoBundledProduct

Mock

import { MockMagentoBundledProduct } from '@daffodil/product-composite/driver/magento/testing'

class MockMagentoBundledProduct extends MockMagentoCoreProduct implements MagentoBundledProduct {
  __typename: MagentoProductTypeEnum = MagentoProductTypeEnum.BundledProduct
  items: MagentoBundledProductItem[] = this.createBundleItems()
  canonical_url: faker.internet.url() = faker.internet.url()
  meta_title: faker.lorem.word() = faker.lorem.word()
  meta_description: faker.lorem.words(3) = faker.lorem.words(3)
  stock_status: MagentoProductStockStatusEnum = MagentoProductStockStatusEnum.InStock
  description: { __typename: string; html: any; } = {
      __typename: 'ComplexTextValue',
      html: faker.lorem.words(5),
    }
  short_description: { __typename: string; html: any; } = {
      __typename: 'ComplexTextValue',
      html: faker.lorem.words(3),
    }
  media_gallery_entries: any[] = []
  uid: faker.string.uuid() = faker.string.uuid()
  url_key: faker.string.alphanumeric(16) = faker.string.alphanumeric(16)
  url_suffix: string = '.html'
  name: faker.lorem.word() = faker.lorem.word()
  sku: faker.string.alphanumeric(16) = faker.string.alphanumeric(16)
  image: { __typename: string; label: any; url: any; } = {
      __typename: 'ProductImage',
      label: faker.lorem.words(3),
      url: faker.image.url(),
    }
  price_range: { __typename: string; maximum_price: { __typename: string; regular_price: { __typename: string; value: any; currency: any; }; discount: { __typename: string; amount_off: any; percent_off: any; }; }; } = {
      __typename: 'PriceRange',
      maximum_price: {
        __typename: 'ProductPrice',
        regular_price: {
          __typename: 'Money',
          value: faker.number.int({ min: 100, max: 1000 }),
          currency: null,
        },
        discount: {
          __typename: 'ProductDiscount',
          amount_off: faker.number.int({ min: 1, max: 99 }),
          percent_off: faker.number.int({ min: 1, max: 99 }),
        },
      },
    }
}