summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/books/init/.gitignore3
-rw-r--r--test/books/init/SUMMARY.md6
-rw-r--r--test/init.js23
3 files changed, 32 insertions, 0 deletions
diff --git a/test/books/init/.gitignore b/test/books/init/.gitignore
new file mode 100644
index 0000000..8a88b2a
--- /dev/null
+++ b/test/books/init/.gitignore
@@ -0,0 +1,3 @@
+*
+!SUMMARY.md
+!.gitignore
diff --git a/test/books/init/SUMMARY.md b/test/books/init/SUMMARY.md
new file mode 100644
index 0000000..1e63aed
--- /dev/null
+++ b/test/books/init/SUMMARY.md
@@ -0,0 +1,6 @@
+# Summary
+
+* [Hello](hello.md)
+* [Hello 2](hello2.md)
+* Hello 3
+ * [Hello 4](hello3/hello4.md)
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;
+ });
+});