md-to-html test

This commit is contained in:
antelle 2020-03-21 11:45:40 +01:00
parent 5cac16a632
commit 4f53e39f8d
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
import { expect } from 'chai';
import { MdToHtml } from 'util/formatting/md-to-html';
describe('MdToHtml', () => {
it('should convert markdown', () => {
expect(MdToHtml.convert('## head\n_italic_')).to.eql(
'<div class="markdown"><h2>head</h2>\n<p><em>italic</em></p>\n</div>'
);
});
it('should not add markdown wrapper tags for plaintext', () => {
expect(MdToHtml.convert('plain\ntext')).to.eql('plain\ntext');
});
it('should convert links', () => {
expect(MdToHtml.convert('[link](https://x)')).to.eql(
'<div class="markdown">' +
'<p><a href="https://x" rel="noreferrer noopener" target="_blank">link</a></p>\n' +
'</div>'
);
});
});