GitHub

MockMagentoBundleCartItem

Mock

import { MockMagentoBundleCartItem } from '@daffodil/cart/driver/magento/testing'

class MockMagentoBundleCartItem extends MockMagentoCartItem implements MagentoBundleCartItem {
  __typename: MagentoCartItemTypeEnum = MagentoCartItemTypeEnum.Bundle
  bundle_options: { id: any; type: string; label: any; price: any; quantity: number; values: { id: any; label: any; price: any; quantity: number; }[]; }[] = [
      {
        id: enforceUnique(faker.number.int),
        type: 'radio',
        label: faker.lorem.word(),
        price: faker.number.int({ min: 1, max: 99 }),
        quantity: 1,
        values: [{
          id: enforceUnique(faker.number.int),
          label: faker.lorem.word(),
          price: faker.number.int({ min: 1, max: 99 }),
          quantity: 1,
        }],
      },
    ]
  id: faker.string.uuid() = faker.string.uuid()
  prices: { __typename: string; price: MagentoMoney; row_total: MagentoMoney; discounts: MagentoDiscount[]; } = {
      __typename: 'CartItemPrices',
      price: this.money(),
      row_total: this.money(),
      discounts: this.discounts(faker.number.int({ min: 0, max: 2 })),
    }
  product: MagentoCartItemProduct = this.createProduct()
  quantity: faker.number.int({ min: 1, max: 20 }) = faker.number.int({ min: 1, max: 20 })
}