diff options
Diffstat (limited to 'test/locate.js')
-rw-r--r-- | test/locate.js | 28 |
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')); + }); + }); + +}); |