summaryrefslogtreecommitdiffstats
path: root/test/init.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2015-05-27 21:05:36 +0200
committerSamy Pesse <samypesse@gmail.com>2015-05-27 21:05:36 +0200
commit36e2236e6bad2071ae604eccb46331bb7da3b79c (patch)
treea8aafce09b34979dbb3bc38ad6fb3df30725baa6 /test/init.js
parent72df665520353d404efbf9fe46d3afd73631884e (diff)
downloadgitbook-36e2236e6bad2071ae604eccb46331bb7da3b79c.zip
gitbook-36e2236e6bad2071ae604eccb46331bb7da3b79c.tar.gz
gitbook-36e2236e6bad2071ae604eccb46331bb7da3b79c.tar.bz2
Fix #765: in init handle correctly empty entries
Add tests for it, fix #769
Diffstat (limited to 'test/init.js')
-rw-r--r--test/init.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/init.js b/test/init.js
new file mode 100644
index 0000000..3ba701f
--- /dev/null
+++ b/test/init.js
@@ -0,0 +1,23 @@
+var fs = require('fs');
+var path = require('path');
+var should = require('should');
+
+var Book = require('../').Book;
+var LOG_LEVELS = require('../').LOG_LEVELS;
+
+describe('Init Books', function () {
+ var initRoot;
+
+ before(function() {
+ initRoot = path.resolve(__dirname, "books/init");
+ return Book.init(initRoot, {
+ logLevel: LOG_LEVELS.DISABLED,
+ });
+ });
+
+ it('should create all chapters', function() {
+ should(fs.existsSync(path.resolve(initRoot, "hello.md"))).be.ok;
+ should(fs.existsSync(path.resolve(initRoot, "hello2.md"))).be.ok;
+ should(fs.existsSync(path.resolve(initRoot, "hello3/hello4.md"))).be.ok;
+ });
+});