verdnatura-chat/app/containers/markdown/formatHyperlink.test.ts

27 lines
1.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { formatHyperlink } from './formatHyperlink';
describe('FormatText', () => {
test('empty to be empty', () => {
expect(formatHyperlink('')).toBe('');
});
test('A123 to be A123', () => {
expect(formatHyperlink('A123')).toBe('A123');
});
test('Format <http://link|Text> to be <http://link|Text>', () => {
expect(formatHyperlink('<http://link|Text>')).toBe('<http://link|Text>');
});
test('Format "[ ](https://open.rocket.chat/) Test" to be Test', () => {
expect(formatHyperlink('[ ](https://open.rocket.chat/) Test')).toBe('Test');
});
test('Format "[Open](https://open.rocket.chat/) Test" to be Test', () => {
expect(formatHyperlink('[Open](https://open.rocket.chat/) Test')).toBe('[Open](https://open.rocket.chat/) Test');
});
test('render test (arabic)', () => {
expect(formatHyperlink('[ ](https://open.rocket.chat/) اختبا')).toBe('اختبا');
});
test('render test (russian)', () => {
expect(formatHyperlink('[ ](https://open.rocket.chat/) тест123')).toBe(ест123');
});
});