summaryrefslogtreecommitdiffstats
path: root/test/summary.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-03-24 23:14:17 +0100
committerSamy Pessé <samypesse@gmail.com>2015-03-24 23:14:17 +0100
commitc9af209a9335ea1219c3149eb12c2daa271c9403 (patch)
tree72df3edf7a67db465ce2dacbbf204974253b818a /test/summary.js
parent63ee94ff89d10e56d82079183c494f8129b92eae (diff)
parent48ab44a776b665b1d3627192cf82e9220ec74678 (diff)
downloadgitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.zip
gitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.tar.gz
gitbook-c9af209a9335ea1219c3149eb12c2daa271c9403.tar.bz2
Merge pull request #667 from GitbookIO/better-testing
Better Unit Tests
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..99cdf6b
--- /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")
+ .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");
+ });
+ });
+});