GitHub

MockMagentoCart

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

class MockMagentoCart implements MagentoCart {
  __typename: string = 'Cart'
  id: faker.datatype.uuid() = faker.datatype.uuid()
  prices: { __typename: string; subtotal_excluding_tax: MagentoMoney; grand_total: MagentoMoney; subtotal_including_tax: MagentoMoney; subtotal_with_discount_excluding_tax: MagentoMoney; applied_taxes: { ...; }[]; discounts: { ...; }[]; } = {
      __typename: 'CartPrices',
      subtotal_excluding_tax: this.money(),
      grand_total: this.money(),
      subtotal_including_tax: this.money(),
      subtotal_with_discount_excluding_tax: this.money(),
      applied_taxes: [{
        __typename: 'AppliedTax',
        amount: this.money(),
        label: 'tax',
      }],
      discounts: [{
        __typename: 'Discount',
        amount: this.money(),
        label: 'discount',
      }],
    }
  applied_coupons: any[] = []
  items: any[] = []
  billing_address: null = null
  shipping_addresses: any[] = []
  available_payment_methods: any[] = []
  selected_payment_method: null = null
  email: faker.internet.email() = faker.internet.email()
}