summaryrefslogtreecommitdiffstats
path: root/test/summary.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-24 13:11:29 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-24 13:11:29 +0100
commit73c69923b34b30105750d1e72990d5a9b0ca1596 (patch)
tree659ae14dc13b6d4478ba615d93df343f60e4374a /test/summary.js
parentafbca4bdf522f01e12cf61ec738c5c81fc05209b (diff)
downloadgitbook-73c69923b34b30105750d1e72990d5a9b0ca1596.zip
gitbook-73c69923b34b30105750d1e72990d5a9b0ca1596.tar.gz
gitbook-73c69923b34b30105750d1e72990d5a9b0ca1596.tar.bz2
Add test for summary parsing
Update gitbook-parsers
Diffstat (limited to 'test/summary.js')
-rw-r--r--test/summary.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/summary.js b/test/summary.js
new file mode 100644
index 0000000..3837651
--- /dev/null
+++ b/test/summary.js
@@ -0,0 +1,45 @@
+var fs = require('fs');
+var path = require('path');
+
+describe('Summary', function () {
+ describe('Parsing', function() {
+ var book;
+
+ before(function() {
+ return books.parse("summary", "website")
+ .then(function(_book) {
+ book = _book;
+ });
+ });
+
+ it('should correctly list items', function() {
+ book.should.have.property("summary");
+ book.summary.should.have.property("chapters");
+ book.summary.chapters.should.have.lengthOf(4);
+ });
+
+ it('should correctly mark non-existant entries', function() {
+ book.summary.chapters[0].exists.should.have.equal(true);
+ book.summary.chapters[1].exists.should.have.equal(true);
+ book.summary.chapters[2].exists.should.have.equal(true);
+ book.summary.chapters[3].exists.should.have.equal(false);
+ });
+ });
+
+ describe('Generation', function() {
+ var book;
+
+ before(function() {
+ return books.generate("summary", "website")
+ .then(function(_book) {
+ book = _book;
+ });
+ });
+
+ it('should create files according to summary', function() {
+ book.should.have.file("index.html");
+ book.should.have.file("PAGE1.html");
+ book.should.have.file("folder/PAGE2.html");
+ });
+ });
+});