import { MockMagentoConfigurableProduct } from '@daffodil/product-configurable/driver/magento/testing'
class MockMagentoConfigurableProduct extends MockMagentoCoreProduct implements MagentoConfigurableProduct {
__typename: MagentoProductTypeEnum = MagentoProductTypeEnum.ConfigurableProduct
configurable_options: { attribute_code: string; label: string; position: number; values: { label: string; value_index: number; }[]; }[] = [
{
attribute_code: 'color',
label: 'Color',
position: 0,
values: [
{
label: 'Blue',
value_index: 0,
},
{
label: 'Yellow',
value_index: 1,
},
{
label: 'Red',
value_index: 2,
},
],
},
]
variants: ({ attributes: { code: string; value_index: number; }[]; product: { __typename: MagentoProductTypeEnum; uid: any; url_key: any; url_suffix: string; name: any; sku: any; stock_status: MagentoProductStockStatusEnum; image: { ...; }; thumbnail: { ...; }; price_range: { ...; }; }; } | { ...; })[] = [
{
attributes: [
{
code: 'color',
value_index: 0,
},
],
product: {
__typename: MagentoProductTypeEnum.SimpleProduct,
uid: faker.datatype.uuid(),
url_key: faker.random.alphaNumeric(16),
url_suffix: '.html',
name: faker.random.word(),
sku: faker.random.alphaNumeric(16),
stock_status: MagentoProductStockStatusEnum.InStock,
image: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
thumbnail: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
price_range: {
__typename: 'PriceRange',
maximum_price: {
__typename: 'ProductPrice',
regular_price: {
__typename: 'Money',
value: this.priceVariant1,
currency: null,
},
discount: {
__typename: 'ProductDiscount',
amount_off: this.discountVariant1,
percent_off: this.discountVariant1/this.priceVariant1,
},
},
},
},
},
{
attributes: [
{
code: 'color',
value_index: 1,
},
],
product: {
__typename: MagentoProductTypeEnum.SimpleProduct,
uid: faker.datatype.uuid(),
url_key: faker.random.alphaNumeric(16),
url_suffix: '.html',
name: faker.random.word(),
sku: faker.random.alphaNumeric(16),
stock_status: MagentoProductStockStatusEnum.InStock,
image: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
thumbnail: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
price_range: {
__typename: 'PriceRange',
maximum_price: {
__typename: 'ProductPrice',
regular_price: {
__typename: 'Money',
value: this.priceVariant2,
currency: null,
},
discount: {
amount_off: this.discountVariant2,
percent_off: this.discountVariant2/this.priceVariant2,
},
},
},
},
},
{
attributes: [
{
code: 'color',
value_index: 2,
},
],
product: {
__typename: MagentoProductTypeEnum.SimpleProduct,
uid: faker.datatype.uuid(),
url_key: faker.random.alphaNumeric(16),
url_suffix: '.html',
name: faker.random.word(),
sku: faker.random.alphaNumeric(16),
stock_status: MagentoProductStockStatusEnum.InStock,
image: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
thumbnail: {
__typename: 'ProductImage',
label: faker.random.words(3),
url: faker.image.imageUrl(),
},
price_range: {
__typename: 'PriceRange',
maximum_price: {
__typename: 'ProductPrice',
regular_price: {
__typename: 'Money',
value: this.priceVariant3,
currency: null,
},
discount: {
amount_off: this.discountVariant3,
percent_off: this.discountVariant3/this.priceVariant3,
},
},
},
},
},
]
}