/** * The ship page's "Customer paid · Your cost" notice compares what the customer paid with * what the label really costs the merchant. */ import { merchantLabelCost, merchantPaysNet } from '../features/order-ship/utils/merchantLabelCost'; const price = { net: 420, gross: 504 }; describe('merchantLabelCost', () => { it('uses the net price for a VAT-registered merchant, even when the customer paid no VAT', () => { // The review's case: exempt customer paid £4.20, no VAT. The merchant reclaims VAT, so no loss. expect(merchantLabelCost(price, 'business-registered', 0)).toBe(420); }); it('uses the gross price for merchants who are not VAT registered', () => { expect(merchantLabelCost(price, 'individual', 84)).toBe(504); expect(merchantLabelCost(price, 'business-not-registered', 0)).toBe(504); }); it('falls back to whether the customer paid VAT when no status is saved', () => { expect(merchantLabelCost(price, '', 84)).toBe(420); expect(merchantLabelCost(price, undefined, 0)).toBe(504); expect(merchantLabelCost(price, null, 0)).toBe(504); }); }); describe('merchantPaysNet', () => { it('is the net price for VAT-registered merchants, else gross; falls back to the customer VAT', () => { expect(merchantPaysNet('business-registered', 0)).toBe(true); expect(merchantPaysNet('individual', 84)).toBe(false); expect(merchantPaysNet('business-not-registered', 84)).toBe(false); expect(merchantPaysNet('', 84)).toBe(true); expect(merchantPaysNet(undefined, 0)).toBe(false); }); });