GitHub

MockOrder

class

import { MockOrder } from '@daffodil/order/driver/magento/2-4-1/testing'

class MockOrder implements MagentoOrder {
  __typename: "GraycoreGuestOrder" = <const>'GraycoreGuestOrder'
  id: faker.string.uuid() = faker.string.uuid()
  number: faker.string.uuid() = faker.string.uuid()
  email: faker.internet.email() = faker.internet.email()
  order_date: faker.date.past().toString() = faker.date.past().toString()
  status: faker.lorem.word() = faker.lorem.word()
  carrier: faker.lorem.word() = faker.lorem.word()
  shipping_method: faker.lorem.word() = faker.lorem.word()
  total: MagentoOrderTotal = this.totalFactory.create()
  items: MagentoOrderItem[] = this.itemFactory.createMany(faker.number.int({ min: 1, max: 5 }))
  billing_address: MagentoOrderAddress = this.addressFactory.create()
  shipping_address: MagentoOrderAddress = this.addressFactory.create()
  shipments: MagentoOrderShipment[] = this.shipmentFactory.createMany(faker.number.int({ min: 1, max: 3 }))
  payment_methods: MagentoOrderPayment[] = this.paymentFactory.createMany(faker.number.int({ min: 1, max: 3 }))
  invoices: MagentoOrderInvoice[] = this.invoiceFactory.createMany(faker.number.int({ min: 1, max: 3 }))
  credit_memos: MagentoOrderCredit[] = this.creditFactory.createMany(faker.number.int({ min: 1, max: 3 }))
}