Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pwa 2484 refactor #4341

Merged
merged 10 commits into from
Oct 14, 2024
Original file line number Diff line number Diff line change
@@ -1,102 +1,129 @@
export default {
cart: {
id: 'GXtkt675mPd3gYuvhWLd5iw5ekVoDj1b',
total_quantity: 7,
items: [
export default [
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
},
{
id: '29570',
product: {
id: 1115,
name: 'Juno Sweater',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 1,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 21,
value_label: 'Rain',
__typename: 'SelectedConfigurableOption'
},
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 29,
value_label: 'XS',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
},
{
id: '29572',
product: {
id: 1152,
name: 'Angelina Tank Dress',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 20,
value_label: 'Lilac',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 26,
value_label: 'L',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
}
];

export const singleItem = [
{
id: '29568',
product: {
id: 1093,
name: 'Jillian Top',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
id: '29570',
product: {
id: 1115,
name: 'Juno Sweater',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 1,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 21,
value_label: 'Rain',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 29,
value_label: 'XS',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 18,
value_label: 'Peach',
__typename: 'SelectedConfigurableOption'
},
{
id: '29572',
product: {
id: 1152,
name: 'Angelina Tank Dress',
thumbnail: {
url:
'https://master-7rqtwti-c5v7sxvquxwl4.eu-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg',
__typename: 'ProductImage'
},
__typename: 'ConfigurableProduct'
},
quantity: 3,
configurable_options: [
{
configurable_product_option_uid: 179,
option_label: 'Fashion Color',
configurable_product_option_value_uid: 20,
value_label: 'Lilac',
__typename: 'SelectedConfigurableOption'
},
{
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 26,
value_label: 'L',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'ConfigurableCartItem'
configurable_product_option_uid: 182,
option_label: 'Fashion Size',
configurable_product_option_value_uid: 27,
value_label: 'M',
__typename: 'SelectedConfigurableOption'
}
],
__typename: 'Cart'
__typename: 'ConfigurableCartItem'
}
};
];
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,100 @@
exports[`returns correct shape 1`] = `
Object {
"configurableThumbnailSource": "parent",
"hasErrors": false,
"isLoading": true,
"items": Array [],
"setShowAllItems": [Function],
"showAllItems": false,
"totalQuantity": 0,
}
`;

exports[`uses static data if provided 1`] = `
Object {
"configurableThumbnailSource": "parent",
"hasErrors": false,
"isLoading": true,
"items": Array [
Object {
"name": "static item",
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 18,
"option_label": "Fashion Color",
"value_label": "Peach",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 27,
"option_label": "Fashion Size",
"value_label": "M",
},
],
"id": "29568",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1093,
"name": "Jillian Top",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/t/vt12-kh_main_2.jpg",
},
},
"quantity": 3,
},
Object {
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 21,
"option_label": "Fashion Color",
"value_label": "Rain",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 29,
"option_label": "Fashion Size",
"value_label": "XS",
},
],
"id": "29570",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1115,
"name": "Juno Sweater",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/s/vsw02-pe_main_2.jpg",
},
},
"quantity": 1,
},
Object {
"__typename": "ConfigurableCartItem",
"configurable_options": Array [
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 179,
"configurable_product_option_value_uid": 20,
"option_label": "Fashion Color",
"value_label": "Lilac",
},
Object {
"__typename": "SelectedConfigurableOption",
"configurable_product_option_uid": 182,
"configurable_product_option_value_uid": 26,
"option_label": "Fashion Size",
"value_label": "L",
},
],
"id": "29572",
"product": Object {
"__typename": "ConfigurableProduct",
"id": 1152,
"name": "Angelina Tank Dress",
"thumbnail": Object {
"__typename": "ProductImage",
"url": "https://master-7rqtwti-c5v7sxvquxwl4.us-4.magentosite.cloud/media/catalog/product/cache/d3ba9f7bcd3b0724e976dc5144b29c7d/v/d/vd01-ll_main_2.jpg",
},
},
"quantity": 3,
},
],
"setShowAllItems": [Function],
"showAllItems": true,
"totalQuantity": 1,
"showAllItems": false,
"totalQuantity": 7,
}
`;
Loading
Loading