aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/comp/EditorUpload.test.js
blob: caecfb91ea2d03d3643620daf24007fdb41917b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import {removeAttachmentLinksFromMarkdown} from './EditorUpload.js';

test('removeAttachmentLinksFromMarkdown', () => {
  expect(removeAttachmentLinksFromMarkdown('a foo b', 'foo')).toBe('a foo b');
  expect(removeAttachmentLinksFromMarkdown('a [x](attachments/foo) b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a ![x](attachments/foo) b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a [x](/attachments/foo) b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a ![x](/attachments/foo) b', 'foo')).toBe('a  b');

  expect(removeAttachmentLinksFromMarkdown('a <img src="attachments/foo"> b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a <img width="100" src="attachments/foo"> b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a <img src="/attachments/foo"> b', 'foo')).toBe('a  b');
  expect(removeAttachmentLinksFromMarkdown('a <img src="/attachments/foo" width="100"/> b', 'foo')).toBe('a  b');
});