summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-markdown/test
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-19 15:08:07 +0100
committerSamy Pessé <samypesse@gmail.com>2016-12-22 15:00:30 +0100
commit5f9380568d34323cdc570d03d91f8c18b4d07326 (patch)
treec7b025bba4c0997cfa419dddbf6fa28599a47746 /packages/gitbook-markdown/test
parent6568acc992edf405b976a88e3c8abad82fdfd91d (diff)
downloadgitbook-5f9380568d34323cdc570d03d91f8c18b4d07326.zip
gitbook-5f9380568d34323cdc570d03d91f8c18b4d07326.tar.gz
gitbook-5f9380568d34323cdc570d03d91f8c18b4d07326.tar.bz2
Add readme parsing and tests
Diffstat (limited to 'packages/gitbook-markdown/test')
-rw-r--r--packages/gitbook-markdown/test/fixtures/README.md7
-rw-r--r--packages/gitbook-markdown/test/readme.js28
2 files changed, 35 insertions, 0 deletions
diff --git a/packages/gitbook-markdown/test/fixtures/README.md b/packages/gitbook-markdown/test/fixtures/README.md
new file mode 100644
index 0000000..7e20198
--- /dev/null
+++ b/packages/gitbook-markdown/test/fixtures/README.md
@@ -0,0 +1,7 @@
+# This is the title
+
+This is the book description.
+
+other content
+...
+
diff --git a/packages/gitbook-markdown/test/readme.js b/packages/gitbook-markdown/test/readme.js
new file mode 100644
index 0000000..b3a5952
--- /dev/null
+++ b/packages/gitbook-markdown/test/readme.js
@@ -0,0 +1,28 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var readme = require('../').readme;
+
+
+var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/README.md'), 'utf8');
+var LEXED = readme(CONTENT);
+
+describe('Readme parsing', function () {
+
+ it('should contain a title', function() {
+ assert(LEXED.title);
+ });
+
+ it('should contain a description', function() {
+ assert(LEXED.description);
+ });
+
+ it('should extract the right title', function() {
+ assert.equal(LEXED.title, "This is the title");
+ });
+
+ it('should extract the right description', function() {
+ assert.equal(LEXED.description, "This is the book description.");
+ });
+});