const money=require("../../app/services/pricing/money"),s=require("../../app/validation/shopping.schemas"),checkout=require("../../app/services/shopping/checkout.service");const input=body=>({body,params:{},query:{}});describe("Phase 6 commerce boundaries",()=>{test("calculates line totals without floating point",()=>{expect(money.multiply("999.99",3)).toBe("2999.97");expect(money.add("2999.97","250.03")).toBe("3250.00");});test("rejects client-controlled checkout totals",()=>expect(()=>s.checkout.parse(input({shippingAddressId:"a",billingAddressId:"b",shippingMethodId:"m",grandTotal:"1.00"}))).toThrow());test("requires positive integer cart quantities",()=>expect(()=>s.cartItem.parse(input({variantId:"v",quantity:1.5}))).toThrow());test("idempotency fingerprints identical payloads deterministically",()=>expect(checkout.fingerprint({a:1})).toBe(checkout.fingerprint({a:1})));test("address snapshots omit ownership and internal fields",()=>expect(checkout.addressSnapshot({recipient_name:"A",phone_number:"1",address_line_1:"X",country_code:"LK",user_id:"secret"})).toEqual({recipientName:"A",phone:"1",addressLine1:"X",addressLine2:undefined,city:undefined,district:undefined,province:undefined,postalCode:undefined,countryCode:"LK"}));});