2018-09-22 19:58:33 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
|
|
|
import * as smartmarkdown from '../ts/index';
|
|
|
|
|
2019-06-17 09:56:39 +00:00
|
|
|
let smartMarkdownInstance: smartmarkdown.SmartMarkdown;
|
|
|
|
|
|
|
|
tap.test('should create a valid instance of SmartMarkdown', async () => {
|
|
|
|
smartMarkdownInstance = new smartmarkdown.SmartMarkdown();
|
|
|
|
expect(smartMarkdownInstance).to.be.instanceOf(smartmarkdown.SmartMarkdown);
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should convert a markdown string to html', async () => {
|
|
|
|
const markdownString = '# Hi!';
|
2021-10-04 11:35:20 +00:00
|
|
|
const htmlString = await smartMarkdownInstance.markdownToHtml(markdownString);
|
|
|
|
expect(htmlString).to.equal('<h1>Hi!</h1>\n');
|
2019-06-17 09:56:39 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should convert a html string to markdown', async () => {
|
|
|
|
const htmlString = '<h1 id="hi">Hi!</h1>\n<h2>This is it!</h2>';
|
|
|
|
const markdownString = smartMarkdownInstance.htmlToMarkdown(htmlString);
|
|
|
|
console.log(markdownString);
|
2018-09-22 19:58:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tap.start();
|