From be4284bdd6fe13b155b61605620d02dec5be8716 Mon Sep 17 00:00:00 2001 From: fatequod Date: Tue, 22 Sep 2026 12:01:03 +0200 Subject: [PATCH] test(prestashop): cover bundle prices for products and combinations --- test/order-importer-metadata.test.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/order-importer-metadata.test.js b/test/order-importer-metadata.test.js index 7301c9d..77777a5 100644 --- a/test/order-importer-metadata.test.js +++ b/test/order-importer-metadata.test.js @@ -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', ]);