import MessageFormatter from '../MessageFormatter'; describe('#MessageFormatter', () => { describe('content with links', () => { it('should format correctly', () => { const message = 'Chatwoot is an opensource tool\nSee more at https://www.chatwoot.com'; expect(new MessageFormatter(message).formattedMessage).toEqual( 'Chatwoot is an opensource tool
See more at https://www.chatwoot.com' ); }); }); describe('tweets', () => { it('should return the same string if not tags or @mentions', () => { const message = 'Chatwoot is an opensource tool'; expect(new MessageFormatter(message).formattedMessage).toEqual(message); }); it('should add links to @mentions', () => { const message = '@chatwootapp is an opensource tool thanks @longnonexistenttwitterusername'; expect(new MessageFormatter(message, true).formattedMessage).toEqual( '@chatwootapp is an opensource tool thanks @longnonexistenttwitterusername' ); }); it('should add links to #tags', () => { const message = '#chatwootapp is an opensource tool'; expect(new MessageFormatter(message, true).formattedMessage).toEqual( '#chatwootapp is an opensource tool' ); }); }); });