=== Testing DiscountEngine === ✓ DiscountEngine initialized Current strategy: best_only --- Test 1: No Discounts --- Product: Standard Widget Price: $100 Has Discount: No Expected: No discount applied --- Test 2: Product Percentage Discount (Manual Calculation) --- Original Price: $100.00 Discount: 20% off Discount Amount: $20.00 Final Price: $80.00 Expected: $80.00 --- Test 3: Category Percentage Discount (Manual Calculation) --- Original Price: $50.00 Category Discount: 15% off Discount Amount: $7.50 Final Price: $42.50 Expected: $42.50 --- Test 4: BOGO Discount (Buy 1 Get 1 Free) --- Unit Price: $30.00 Promotion: Buy 1 Get 1 Free Effective Discount: 50.00% Price Per Unit: $15.00 Expected: $15.00 per unit (50% off) --- Test 5: Bundle Pricing (3 for $10) --- Regular Price: $5.00 each Bundle: 3 for $10.00 Bundle Price Per Item: $3.33 Savings: $1.67 per item (33.33%) Expected: $3.33 per item --- Test 6: Quantity Threshold Discount (Buy 5+ Save 20%) --- Unit Price: $40.00 Quantity: 6 (threshold: 5+) Discount: 20% off Final Price Per Unit: $32.00 Expected: $32.00 per unit --- Test 7: Best Discount Selection --- Category 15% off: $85.00 (save $15.00) Product 20% off: $80.00 (save $20.00) Store 10% off: $90.00 (save $10.00) Best Discount: Product 20% off Final Price: $80.00 Expected: Product 20% off → $80.00 --- Test 8: Stacking Strategy --- Default strategy: best_only Changed to: stack_all Changed to: priority_order Reset to: best_only --- Test 9: Edge Case - Negative Price Prevention --- Price: $10.00 Discount: $15.00 Final Price: $0.00 Expected: $0.00 (prevented negative) --- Test 10: Mixed Cart Example --- Widget A: $100 × 2 = $200.00 - $40.00 (20%) = $160.00 Widget B: $50 × 1 = $50.00 - $7.50 (15%) = $42.50 Widget C: $75 × 3 = $225.00 Subtotal: $475.00 Total Discount: $47.50 Total: $427.50 === All Tests Complete === ✓ DiscountEngine logic validated ✓ Ready for database integration ✓ Ready for POS integration Next Steps: 1. Insert test discount data into database 2. Test with real database queries 3. Integrate into PosController.php 4. Update POS.js to display discounts