Skip to content

Commit 32dda7b

Browse files
author
rebeca
committed
add test sku selector alphatical order
1 parent dbce3c1 commit 32dda7b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

react/__tests__/components/SKUSelector.test.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,4 +1408,55 @@ describe('<SKUSelector />', () => {
14081408

14091409
expect(queryByText('Yellow')).toBeFalsy()
14101410
})
1411+
1412+
it('must order sku specification to be sorted in alphabetical order', async () => {
1413+
const defaultSeller = {sellerDefault: true, commertialOffer: { Price: 1, ListPrice: 1, AvailableQuantity: 2 }}
1414+
1415+
const skuItems = [
1416+
{
1417+
itemId: '1',
1418+
name: 'Gray Shoe',
1419+
variations: [
1420+
{ name: 'Size', values: ['43'] },
1421+
{ name: 'Color', values: ['Gray'] },
1422+
],
1423+
sellers: [defaultSeller],
1424+
images: [],
1425+
},
1426+
{
1427+
itemId: '4',
1428+
name: 'Gray Shoe',
1429+
variations: [
1430+
{
1431+
name: 'Size',
1432+
values: ['42'],
1433+
},
1434+
{ name: 'Color', values: ['Gray'] },
1435+
],
1436+
sellers: [defaultSeller],
1437+
images: [],
1438+
},
1439+
{
1440+
itemId: '4',
1441+
name: 'Gray Shoe',
1442+
variations: [
1443+
{
1444+
name: 'Size',
1445+
values: ['41'],
1446+
},
1447+
{ name: 'Color', values: ['Gray'] },
1448+
],
1449+
sellers: [defaultSeller],
1450+
images: [],
1451+
},
1452+
]
1453+
1454+
const {container} = renderComponent({ sortVariationsByLabel:true,skuSelected:skuItems[0], skuItems:skuItems})
1455+
1456+
const options = container.querySelectorAll('.skuSelectorItemTextValue')
1457+
expect(options[0]).toHaveTextContent('41')
1458+
expect(options[1]).toHaveTextContent('42')
1459+
expect(options[2]).toHaveTextContent('43')
1460+
})
14111461
})
1462+

0 commit comments

Comments
 (0)