diff --git a/src/cdk/v2/destinations/rakuten/utils.js b/src/cdk/v2/destinations/rakuten/utils.js index 5a688f278d..b4897c46ed 100644 --- a/src/cdk/v2/destinations/rakuten/utils.js +++ b/src/cdk/v2/destinations/rakuten/utils.js @@ -26,7 +26,7 @@ const calculateProductAmount = (product) => { if (!product?.amount && !product?.price) { throw new InstrumentationError('Either amount or price is required for every product'); } - return Math.round(product.amount) * 100 || (product.quantity || 1) * 100 * product.price; + return Math.round(product.amount * 100 || (product.quantity || 1) * 100 * product.price); }; /** diff --git a/src/cdk/v2/destinations/rakuten/utils.test.js b/src/cdk/v2/destinations/rakuten/utils.test.js index 0de534d0ea..2d82037b1c 100644 --- a/src/cdk/v2/destinations/rakuten/utils.test.js +++ b/src/cdk/v2/destinations/rakuten/utils.test.js @@ -117,8 +117,6 @@ describe('constructLineItems', () => { }); }); -// Generated by qodo Gen - describe('calculateProductAmount', () => { // Calculates product amount correctly when amount is defined it('should return the correct product amount when amount is defined', () => { @@ -151,29 +149,29 @@ describe('calculateProductAmount', () => { it('should handle cases where amount is a floating-point number', () => { const product = { amount: 5.5, price: 10, quantity: 2 }; const result = calculateProductAmount(product); - expect(result).toEqual(600); + expect(result).toEqual(550); }); it('should handle cases where amount is a floating-point number', () => { const product = { amount: 5.1, price: 10, quantity: 2 }; const result = calculateProductAmount(product); - expect(result).toEqual(500); + expect(result).toEqual(510); }); it('should handle cases where amount is a floating-point number', () => { const product = { amount: 5.19, price: 10, quantity: 2 }; const result = calculateProductAmount(product); - expect(result).toEqual(500); + expect(result).toEqual(519); }); it('should handle cases where amount is a floating-point number', () => { const product = { amount: 5.199, price: 10, quantity: 2 }; const result = calculateProductAmount(product); - expect(result).toEqual(500); + expect(result).toEqual(520); }); it('should handle cases where amount is a floating-point number', () => { const product = { amount: 5.479, price: 10, quantity: 2 }; const result = calculateProductAmount(product); - expect(result).toEqual(500); + expect(result).toEqual(548); }); });