summaryrefslogtreecommitdiffstats
path: root/test/locate.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-23 15:05:32 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-23 15:05:32 +0100
commitf052aacee1140f211ebb9454157fa7a3604005cf (patch)
treef784d8b9fd70bd94b754e13d26e6f6dd548b9908 /test/locate.js
parent13e2ff8035d9a93e4ee8eb79ec71ac92e6f2bf7e (diff)
downloadgitbook-f052aacee1140f211ebb9454157fa7a3604005cf.zip
gitbook-f052aacee1140f211ebb9454157fa7a3604005cf.tar.gz
gitbook-f052aacee1140f211ebb9454157fa7a3604005cf.tar.bz2
Add .gitbook to locate book inside repository
Diffstat (limited to 'test/locate.js')
-rw-r--r--test/locate.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/locate.js b/test/locate.js
new file mode 100644
index 0000000..609f2da
--- /dev/null
+++ b/test/locate.js
@@ -0,0 +1,28 @@
+var path = require('path');
+
+var Book = require('../').Book;
+var mock = require('./mock');
+
+describe('Locate', function() {
+ it('should use root folder if no .gitbook', function() {
+ return mock.setupFS({
+ 'README.md': '# Hello'
+ })
+ .then(function(root) {
+ return Book.locate(mock.fs, root)
+ .should.be.fulfilledWith(root);
+ });
+ });
+
+ it('should use resolve using .gitbook', function() {
+ return mock.setupFS({
+ 'README.md': '# Hello',
+ '.gitbook': './docs'
+ })
+ .then(function(root) {
+ return Book.locate(mock.fs, root)
+ .should.be.fulfilledWith(path.resolve(root, 'docs'));
+ });
+ });
+
+});