summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/QUIZ_PAGE.md15
-rw-r--r--test/fixtures/README.md7
-rw-r--r--test/page.js1
-rw-r--r--test/readme.js28
4 files changed, 51 insertions, 0 deletions
diff --git a/test/fixtures/QUIZ_PAGE.md b/test/fixtures/QUIZ_PAGE.md
index 545d083..a076055 100644
--- a/test/fixtures/QUIZ_PAGE.md
+++ b/test/fixtures/QUIZ_PAGE.md
@@ -31,3 +31,18 @@ Some more nice content ....
[Cool stuff](http://gitbook.io)
[Link to another Markdown file](./xyz/file.md)
+
+---
+
+Quiz test 2: What does Gitbook support?
+- [x] Table-based questions with radio buttons
+- [x] Table-based questions with checkboxes
+- [ ] Telepathy
+- [x] List-based questions with checkboxes
+- [x] List-based questions with radio buttons
+- [ ] Moon-on-a-stick
+
+> Gitbook supports table and list based quiz questions using either radio buttons or checkboxes.
+
+---
+
diff --git a/test/fixtures/README.md b/test/fixtures/README.md
new file mode 100644
index 0000000..7e20198
--- /dev/null
+++ b/test/fixtures/README.md
@@ -0,0 +1,7 @@
+# This is the title
+
+This is the book description.
+
+other content
+...
+
diff --git a/test/page.js b/test/page.js
index a8a3770..52a3df6 100644
--- a/test/page.js
+++ b/test/page.js
@@ -28,6 +28,7 @@ describe('Page parsing', function() {
assert.equal(QUIZ_LEXED[0].type, 'normal');
assert.equal(QUIZ_LEXED[1].type, 'quiz');
assert.equal(QUIZ_LEXED[2].type, 'normal');
+ assert.equal(QUIZ_LEXED[3].type, 'quiz');
});
it('should gen content for normal sections', function() {
diff --git a/test/readme.js b/test/readme.js
new file mode 100644
index 0000000..811591c
--- /dev/null
+++ b/test/readme.js
@@ -0,0 +1,28 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var readme = require('../').parse.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.");
+ });
+});