import { xHandle } from '../x-handle'; describe('xHandle', () => { it('keeps the username of what merchants paste', () => { expect(xHandle('recomazewear')).toBe('recomazewear'); expect(xHandle(' @recomazewear ')).toBe('recomazewear'); expect(xHandle('https://x.com/recomazewear')).toBe('recomazewear'); expect(xHandle('twitter.com/recomazewear?ref=site')).toBe('recomazewear'); expect(xHandle('https://www.twitter.com/@Recomaze_Wear/')).toBe( 'Recomaze_Wear' ); }); it('refuses what is no username', () => { expect(xHandle('')).toBe(''); expect(xHandle('call us maybe')).toBeNull(); expect(xHandle('https://facebook.com/recomazewear')).toBeNull(); expect(xHandle('a_username_far_too_long')).toBeNull(); }); });