summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-markdown/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-markdown/test')
-rw-r--r--packages/gitbook-markdown/test/fixtures/PAGE.md14
-rw-r--r--packages/gitbook-markdown/test/page.js22
2 files changed, 36 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/fixtures/PAGE.md b/packages/gitbook-markdown/test/fixtures/PAGE.md
new file mode 100644
index 0000000..98b2721
--- /dev/null
+++ b/packages/gitbook-markdown/test/fixtures/PAGE.md
@@ -0,0 +1,14 @@
+# Python basics
+
+Python is a nice language, you can add stuff. Bla bla bla.
+
+Some more nice content ....
+
+[Cool stuff](http://gitbook.io)
+
+[Link to another Markdown file](./xyz/file.md)
+
+And look at this pretty picture:
+![Pretty](../assets/my-pretty-picture.png "Pretty")
+
+Lets go for another exercise but this time with some context :
diff --git a/packages/gitbook-markdown/test/page.js b/packages/gitbook-markdown/test/page.js
new file mode 100644
index 0000000..158f09f
--- /dev/null
+++ b/packages/gitbook-markdown/test/page.js
@@ -0,0 +1,22 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var page = require('../').page;
+
+function loadPage (name, options) {
+ var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/' + name + '.md'), 'utf8');
+ return page(CONTENT, options).sections;
+}
+
+var LEXED = loadPage('PAGE');
+
+describe('Page parsing', function() {
+ it('should detect sections', function() {
+ assert.equal(LEXED.length, 1);
+ });
+
+ it('should gen content for normal sections', function() {
+ assert(LEXED[0].content);
+ });
+});