DaffMockCartItem
import { DaffMockCartItem } from '@daffodil/cart/testing'
class DaffMockCartItem implements DaffCartItem {
id: faker.datatype.uuid()
type: DaffCartItemInputType.Simple
product_id: faker.datatype.uuid()
parent_item_id: faker.datatype.uuid()
image: <DaffProductImage>new DaffProductImageFactory().create()
sku: 'sku'
name: 'Product Name'
url: `/${faker.internet.domainWord()}.html`
qty: faker.datatype.number({ min: 1, max: 100 })
price: faker.datatype.number({ min: 10, max: 1500 })
row_total: this.qty * this.price
in_stock: true
_numberOfDiscounts: faker.datatype.number({ min: 1, max: 2 })
discounts: this._discounts(this._numberOfDiscounts, Math.floor(this.price / this._numberOfDiscounts))
}
Properties
Name | Type | Description |
---|---|---|
id | faker.datatype.uuid() | |
type | DaffCartItemInputType.Simple | |
product_id | faker.datatype.uuid() | |
parent_item_id | faker.datatype.uuid() | |
image | <DaffProductImage>new DaffProductImageFactory().create() | |
sku | 'sku' | |
name | 'Product Name' | |
url | `/${faker.internet.domainWord()}.html` | |
qty | faker.datatype.number({ min: 1, max: 100 }) | |
price | faker.datatype.number({ min: 10, max: 1500 }) | |
row_total | this.qty * this.price | |
in_stock | true | |
_numberOfDiscounts | faker.datatype.number({ min: 1, max: 2 }) | |
discounts | this._discounts(this._numberOfDiscounts, Math.floor(this.price / this._numberOfDiscounts)) |