GitHub

MockMagentoCartItem

import { MockMagentoCartItem } from '@daffodil/cart/driver/magento/testing'
class MockMagentoCartItem implements MagentoCartItem {
  __typename: MagentoCartItemTypeEnum.Simple
  id: faker.datatype.uuid()
  prices: {
      __typename: 'CartItemPrices',
      price: this.money(),
      row_total: this.money(),
      discounts: this.discounts(faker.datatype.number({ min: 0, max: 2 }))
  }
  product: this.createProduct()
  quantity: faker.datatype.number({ min: 1, max: 20 })
}

Properties

Name Type Description
__typename MagentoCartItemTypeEnum.Simple
id faker.datatype.uuid()
prices { __typename: 'CartItemPrices', price: this.money(), row_total: this.money(), discounts: this.discounts(faker.datatype.number({ min: 0, max: 2 })) }
product this.createProduct()
quantity faker.datatype.number({ min: 1, max: 20 })