1
0
Fork 0

integrate markdown-it-testgen

This commit is contained in:
Waylon Flinn 2016-04-21 12:40:31 -05:00
parent 1423f6e58f
commit ae37a845e7
3 changed files with 30 additions and 4 deletions

View file

@ -25,6 +25,7 @@
},
"devDependencies": {
"markdown-it": "^6.0.0",
"markdown-it-testgen": "^0.1.4",
"tape": "^4.5.1"
}
}

View file

@ -1,9 +1,26 @@
var tape = require('tape'),
var path = require('path'),
tape = require('tape'),
testLoad = require('markdown-it-testgen').load,
mdk = require('../index');
var md = require('markdown-it')()
.use(mdk);
tape("hello tape", function(t){
t.plan(1);
/* this uses the markdown-it-testgen module to automatically generate tests
based on an easy to read text file
*/
testLoad(path.join(__dirname, 'fixtures/default.txt'), function(data){
data.fixtures.forEach(function (fixture){
t.assert(true, "it works!");
tape(fixture.header, function(t){
t.plan(1);
var expected = fixture.second.text,
actual = md.render(fixture.first.text);
t.equals(actual, expected);
//generate(, { "assert" : t.assert }, md);
});
});
});

8
test/fixtures/default.txt vendored Normal file
View file

@ -0,0 +1,8 @@
Simple inline math
.
$1+1 = 2$
.
<p><span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mn>1</mn><mo>=</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">1+1 = 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.64444em;"></span><span class="strut bottom" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mrel">=</span><span class="mord mathrm">2</span></span></span></span></p>
.