test(prestashop): cover bundle prices for products and combinations

This commit is contained in:
fatequod
2026-09-22 12:01:03 +02:00
parent 3030e9439c
commit be4284bdd6
+11 -1
View File
@@ -59,12 +59,19 @@ test('order import passes verified metadata and pack facts only through core/ord
const products = {
'10': {
id: '10', name: 'Pack', reference: 'PACK-BASE', manufacturer_name: 'Pack Brand', location: 'BASE-BIN',
price: '8', weight: '1', type: 'pack', associations: { product_bundle: [{ id: '20', id_product_attribute: '200', quantity: '2' }] },
price: '8', weight: '1', type: 'pack', associations: { product_bundle: [
{ id: '20', id_product_attribute: '200', quantity: '2' },
{ id: '21', id_product_attribute: '0', quantity: '1' },
] },
},
'20': {
id: '20', name: 'Item', reference: 'ITEM-BASE', manufacturer_name: 'Item Brand', location: 'ITEM-BASE-BIN',
price: '3', weight: '2', type: 'standard', associations: {},
},
'21': {
id: '21', name: 'Regular item', reference: 'REGULAR-ITEM', manufacturer_name: 'Regular Brand',
location: 'REGULAR-BIN', price: '4.5', weight: '0.5', type: 'standard', associations: {},
},
'30': {
id: '30', name: 'Variant product', reference: 'VARIANT-BASE', manufacturer_name: 'Variant Brand',
location: 'VARIANT-BASE-BIN', price: '15', weight: '1', type: 'standard', associations: {},
@@ -104,6 +111,9 @@ test('order import passes verified metadata and pack facts only through core/ord
assert.equal(createdOrder.products[0].pack[0].sourceId, 'product:20:combination:200');
assert.equal(createdOrder.products[0].pack[0].previousSourceId, '20');
assert.equal(createdOrder.products[0].pack[0].baseUnitPrice, 3.25);
assert.equal(createdOrder.products[0].pack[1].sourceId, 'product:21:combination:0');
assert.equal(createdOrder.products[0].pack[1].sku, 'REGULAR-ITEM');
assert.equal(createdOrder.products[0].pack[1].baseUnitPrice, 4.5);
assert.deepEqual(createdOrder.products.slice(1).map(product => product.sku), [
'VARIANT-BLUE', 'VARIANT-RED',
]);