diff --git a/package.json b/package.json index 98bc56d..337297e 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "devDependencies": { "markdown-it": "^6.0.0", + "markdown-it-testgen": "^0.1.4", "tape": "^4.5.1" } } diff --git a/test/all.js b/test/all.js index cb1003f..2e58e0f 100644 --- a/test/all.js +++ b/test/all.js @@ -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); + }); + }); }); diff --git a/test/fixtures/default.txt b/test/fixtures/default.txt new file mode 100644 index 0000000..20adc5b --- /dev/null +++ b/test/fixtures/default.txt @@ -0,0 +1,8 @@ + +Simple inline math +. +$1+1 = 2$ + +. +

1+1=21+1 = 2

+.