diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/config.js | 6 | ||||
-rw-r--r-- | test/glossary.js | 4 | ||||
-rw-r--r-- | test/langs.js | 2 | ||||
-rw-r--r-- | test/locate.js | 27 | ||||
-rw-r--r-- | test/plugins.js | 4 | ||||
-rw-r--r-- | test/readme.js | 2 |
6 files changed, 26 insertions, 19 deletions
diff --git a/test/config.js b/test/config.js index be28fc9..d997c46 100644 --- a/test/config.js +++ b/test/config.js @@ -46,7 +46,7 @@ describe('Configuration', function() { return mock.setupDefaultBook() .then(function(_book) { book = _book; - return book.config.load(); + return book.prepareConfig(); }); }); @@ -64,7 +64,7 @@ describe('Configuration', function() { }) .then(function(_book) { book = _book; - return book.config.load(); + return book.prepareConfig(); }); }); @@ -82,7 +82,7 @@ describe('Configuration', function() { }) .then(function(_book) { book = _book; - return book.config.load(); + return book.prepareConfig(); }); }); diff --git a/test/glossary.js b/test/glossary.js index d6d1af6..e1ba82a 100644 --- a/test/glossary.js +++ b/test/glossary.js @@ -7,7 +7,7 @@ describe('Glossary', function() { 'GLOSSARY.md': '' }) .then(function(book) { - return book.config.load() + return book.prepareConfig() .then(function() { return book.glossary.load(); @@ -27,7 +27,7 @@ describe('Glossary', function() { }) .then(function(_book) { book = _book; - return book.config.load(); + return book.prepareConfig(); }) .then(function() { return book.glossary.load(); diff --git a/test/langs.js b/test/langs.js index 91dbd5a..dbde992 100644 --- a/test/langs.js +++ b/test/langs.js @@ -6,7 +6,7 @@ describe('Langs', function() { 'LANGS.md': '' }) .then(function(book) { - return book.config.load() + return book.prepareConfig() .then(function() { return book.langs.load(); 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')); + }); }); }); diff --git a/test/plugins.js b/test/plugins.js index 4d9cdf1..b85e507 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -53,7 +53,7 @@ describe('Plugins', function() { } }) .then(function(book) { - return book.config.load() + return book.prepareConfig() .then(function() { var plugins = new PluginsManager(book); return plugins.install(); @@ -90,7 +90,7 @@ describe('Plugins', function() { } }) .then(function(book2) { - return book2.config.load() + return book2.prepareConfig() .then(function() { var plugin = new BookPlugin(book2, 'test-config'); return plugin.load(PLUGINS_ROOT); diff --git a/test/readme.js b/test/readme.js index 0cf66ff..16aa81a 100644 --- a/test/readme.js +++ b/test/readme.js @@ -6,7 +6,7 @@ describe('Readme', function() { 'README.md': '' }) .then(function(book) { - return book.config.load() + return book.prepareConfig() .then(function() { return book.readme.load(); |