summaryrefslogtreecommitdiffstats
path: root/test/locate.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-29 17:35:12 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-29 17:35:12 +0100
commitec353e179dedf1ebf1ab6e54f6217a88d087ea75 (patch)
tree4a6e90f89a56ea571c0a090e6a524f760da8aa3b /test/locate.js
parent496f253e698f1224fa9f9cf88670648ff3930d7a (diff)
downloadgitbook-ec353e179dedf1ebf1ab6e54f6217a88d087ea75.zip
gitbook-ec353e179dedf1ebf1ab6e54f6217a88d087ea75.tar.gz
gitbook-ec353e179dedf1ebf1ab6e54f6217a88d087ea75.tar.bz2
Remove .gitbook and add "root" option
Diffstat (limited to 'test/locate.js')
-rw-r--r--test/locate.js27
1 files changed, 17 insertions, 10 deletions
diff --git a/test/locate.js b/test/locate.js
index 609f2da..2b6a574 100644
--- a/test/locate.js
+++ b/test/locate.js
@@ -1,27 +1,34 @@
var path = require('path');
+var should = require('should');
var Book = require('../').Book;
var mock = require('./mock');
describe('Locate', function() {
it('should use root folder if no .gitbook', function() {
- return mock.setupFS({
+ return mock.setupBook({
'README.md': '# Hello'
})
- .then(function(root) {
- return Book.locate(mock.fs, root)
- .should.be.fulfilledWith(root);
+ .then(function(book) {
+ return book.prepareConfig()
+ .then(function() {
+ should(book.originalRoot).not.be.ok();
+ });
});
});
- it('should use resolve using .gitbook', function() {
- return mock.setupFS({
+ it('should use resolve using book.js root property', function() {
+ return mock.setupBook({
'README.md': '# Hello',
- '.gitbook': './docs'
+ 'docs/README.md': '# Hello Book',
+ 'book.json': { root: './docs' }
})
- .then(function(root) {
- return Book.locate(mock.fs, root)
- .should.be.fulfilledWith(path.resolve(root, 'docs'));
+ .then(function(book) {
+ return book.prepareConfig()
+ .then(function() {
+ should(book.originalRoot).be.ok();
+ book.root.should.equal(path.resolve(book.originalRoot, 'docs'));
+ });
});
});