/** * The Live courier rates settings warn when a locker or shop service is picked and checkout does * not require the customer's phone. */ import { pickupPhoneNotice } from '../features/settings/utils/pickupPhoneNotice'; const locker = { pickup: 'locker' as const }; const shop = { pickup: 'shop' as const }; const home = { pickup: '' as const }; describe('pickupPhoneNotice', () => { // Positive — a pickup service with an optional or hidden phone field it('warns when a locker or shop service is picked and the phone is not required', () => { expect(pickupPhoneNotice([home, locker], 'optional')).toBe('optional'); expect(pickupPhoneNotice([shop], 'hidden')).toBe('hidden'); }); // Negative — phone required, no pickup service, or the setting is unknown it('does not warn otherwise', () => { expect(pickupPhoneNotice([locker, shop], 'required')).toBeNull(); expect(pickupPhoneNotice([home, {}], 'hidden')).toBeNull(); expect(pickupPhoneNotice([], 'optional')).toBeNull(); expect(pickupPhoneNotice([locker], undefined)).toBeNull(); }); });