summaryrefslogtreecommitdiffstats
path: root/test/locate.js
blob: 609f2da8aaf3403eb86045415de32bba77efbd9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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'));
        });
    });

});