');
+ jira.should.eql('[http://google.com]');
+ });
+ it('should convert named links properly', () => {
+ const jira = j2m.to_jira('[Google](http://google.com)');
+ jira.should.eql('[Google|http://google.com]');
+ });
+ it('should convert headers properly', () => {
+ const h1 = j2m.to_jira('# Biggest heading');
+ const h2 = j2m.to_jira('## Bigger heading');
+ const h3 = j2m.to_jira('### Big heading');
+ const h4 = j2m.to_jira('#### Normal heading');
+ const h5 = j2m.to_jira('##### Small heading');
+ const h6 = j2m.to_jira('###### Smallest heading');
+ h1.should.eql('h1. Biggest heading');
+ h2.should.eql('h2. Bigger heading');
+ h3.should.eql('h3. Big heading');
+ h4.should.eql('h4. Normal heading');
+ h5.should.eql('h5. Small heading');
+ h6.should.eql('h6. Smallest heading');
+ });
+ it('should convert underline-style headers properly', () => {
+ const h1 = j2m.to_jira('Biggest heading\n=======');
+ const h2 = j2m.to_jira('Bigger heading\n------');
+ h1.should.eql('h1. Biggest heading');
+ h2.should.eql('h2. Bigger heading');
+ });
+ it('should convert blockquotes properly', () => {
+ const jira = j2m.to_jira('> This is a long blockquote type thingy that needs to be converted.');
+ jira.should.eql('bq. This is a long blockquote type thingy that needs to be converted.');
+ });
+ it('should convert un-ordered lists properly', () => {
+ const jira = j2m.to_jira('* Foo\n* Bar\n* Baz\n * FooBar\n * BarBaz\n * FooBarBaz\n* Starting Over');
+ jira.should.eql('* Foo\n* Bar\n* Baz\n** FooBar\n** BarBaz\n*** FooBarBaz\n* Starting Over');
+ });
+ it('should convert ordered lists properly', () => {
+ const jira = j2m.to_jira(
+ '1. Foo\n1. Bar\n1. Baz\n 1. FooBar\n 1. BarBaz\n 1. FooBarBaz\n1. Starting Over'
+ );
+ jira.should.eql('# Foo\n# Bar\n# Baz\n## FooBar\n## BarBaz\n### FooBarBaz\n# Starting Over');
+ });
+ it('should handle bold AND italic (combined) correctly', () => {
+ const jira = j2m.to_jira('This is ***emphatically bold***!');
+ jira.should.eql('This is _*emphatically bold*_!');
+ });
+ it('should handle bold within a un-ordered list item', () => {
+ const jira = j2m.to_jira('* This is not bold!\n * This is **bold**.');
+ jira.should.eql('* This is not bold!\n** This is *bold*.');
+ });
+ it('should be able to handle a complicated multi-line markdown string and convert it to markdown', () => {
+ const jiraStr = fs.readFileSync(path.resolve(__dirname, 'test.jira'), 'utf8');
+ const mdStr = fs.readFileSync(path.resolve(__dirname, 'test.md'), 'utf8');
+ const jira = j2m.to_jira(mdStr);
+ jira.should.eql(jiraStr);
+ });
+});
diff --git a/test/test.html b/test/test.html
new file mode 100644
index 0000000..0a7e85c
--- /dev/null
+++ b/test/test.html
@@ -0,0 +1,77 @@
+Biggest heading
+Bigger heading
+Biggest heading
+Bigger heading
+Big heading
+Normal heading
+Small heading
+Smallest heading
+strong
emphasis
monospaced
deleted
inserted
superscript
subscript
+var hello = 'world';
+
+

+http://google.com
Google
+GitHub Flavor
deleted
+ preformatted piece of text
+ so *no_ further _formatting* is done here
+
+Should be bold AND italic
+
+- First li
+- Second li
+
+- Back to first level li
+
+
+- First li
+- Second li
+- Indented li
+- Three columns in li
+
+
+
+
+- Back to first level li
+
+
+- Here's italic inside li
+- here's bold inside li
+- Here's bold + italic inside li
+- Here they are in one line indented: italic bold
+
+
+
+
+Here's a long single-paragraph block quote. It should look pretty and stuff.
+
+
+
+
+A title |
+
+
+
+Panel text |
+
+
+
+
+
+Heading 1 |
+Heading 2 |
+
+
+
+Col A1 |
+Col A2 |
+
+
+Col B1 |
+Col B2 |
+
+
diff --git a/test/test.md b/test/test.md
index 5903e6d..bb3f52b 100755
--- a/test/test.md
+++ b/test/test.md
@@ -45,8 +45,8 @@ GitHub Flavor
1. First li
1. Second li
- 1. Indented li
- 1. Three columns in li
+ 1. Indented li
+ 1. Three columns in li
1. Back to first level li
* Here's *italic* inside li
diff --git a/test/to_html.js b/test/to_html.js
new file mode 100644
index 0000000..8474d3a
--- /dev/null
+++ b/test/to_html.js
@@ -0,0 +1,41 @@
+const should = require('chai').should();
+const fs = require('fs');
+const path = require('path');
+
+const j2m = require('../index');
+
+describe('md_to_html', () => {
+ it('should exist', () => {
+ should.exist(j2m.md_to_html(''));
+ });
+
+ it('should be a function', () => {
+ j2m.md_to_html.should.be.a('function');
+ });
+
+ it('should provide html from md', () => {
+ const mdStr = fs.readFileSync(path.resolve(__dirname, 'test.md'), 'utf8');
+ const htmlStr = fs.readFileSync(path.resolve(__dirname, 'test.html'), 'utf8');
+
+ const html = j2m.md_to_html(mdStr);
+ html.should.eql(htmlStr);
+ });
+});
+
+describe('jira_to_html', () => {
+ it('should exist', () => {
+ should.exist(j2m.jira_to_html(''));
+ });
+
+ it('should be a function', () => {
+ j2m.jira_to_html.should.be.a('function');
+ });
+
+ it('should provide html from md', () => {
+ const jiraStr = fs.readFileSync(path.resolve(__dirname, 'test.jira'), 'utf8');
+ const htmlStr = fs.readFileSync(path.resolve(__dirname, 'test.html'), 'utf8');
+
+ const html = j2m.jira_to_html(jiraStr);
+ html.should.eql(htmlStr);
+ });
+});