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/LANGS.md4
-rw-r--r--packages/gitbook-markdown/test/langs.js18
2 files changed, 22 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/fixtures/LANGS.md b/packages/gitbook-markdown/test/fixtures/LANGS.md
new file mode 100644
index 0000000..eb8b532
--- /dev/null
+++ b/packages/gitbook-markdown/test/fixtures/LANGS.md
@@ -0,0 +1,4 @@
+# Languages
+
+* [English](en)
+* [French](fr)
diff --git a/packages/gitbook-markdown/test/langs.js b/packages/gitbook-markdown/test/langs.js
new file mode 100644
index 0000000..3a1f082
--- /dev/null
+++ b/packages/gitbook-markdown/test/langs.js
@@ -0,0 +1,18 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var langs = require('../').langs;
+
+var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/LANGS.md'), 'utf8');
+var LEXED = langs(CONTENT);
+
+describe('Languages parsing', function () {
+ it('should detect paths and titles', function() {
+ assert.equal(LEXED.list[0].path,'en');
+ assert.equal(LEXED.list[0].title,'English');
+
+ assert.equal(LEXED.list[1].path,'fr');
+ assert.equal(LEXED.list[1].title,'French');
+ });
+});