diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-22 10:16:38 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-22 10:16:38 +0100 |
commit | b23d3a9f37a225eb418967a19c4ddddbf8a76c63 (patch) | |
tree | c35fcc871c920edc78dd6d8aacadc5be1c079973 | |
parent | de31b900803892ef0a441ccffba5d5f6a6c42105 (diff) | |
download | gitbook-b23d3a9f37a225eb418967a19c4ddddbf8a76c63.zip gitbook-b23d3a9f37a225eb418967a19c4ddddbf8a76c63.tar.gz gitbook-b23d3a9f37a225eb418967a19c4ddddbf8a76c63.tar.bz2 |
Add test for extension of book's configuration
-rw-r--r-- | test/plugins.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/plugins.js b/test/plugins.js index a525a7b..4fd59d4 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -3,7 +3,6 @@ var path = require('path'); var mock = require('./mock'); var registry = require('../lib/plugins/registry'); var Output = require('../lib/output/base'); -var error = require('../lib/utils/error'); var PluginsManager = require('../lib/plugins'); var BookPlugin = require('../lib/plugins/plugin'); @@ -78,6 +77,28 @@ describe('Plugins', function() { return plugin.load(PLUGINS_ROOT) .should.be.rejectedWith('Error with book\'s configuration: pluginsConfig.test-config.myProperty is required'); }); + + it('should extend configuration with default properties', function() { + return mock.setupBook({ + 'book.json': { + pluginsConfig: { + 'test-config': { + 'myProperty': 'world' + } + } + } + }) + .then(function(book2) { + return book2.config.load() + .then(function() { + var plugin = new BookPlugin(book2, 'test-config'); + return plugin.load(PLUGINS_ROOT); + }) + .then(function() { + book2.config.get('pluginsConfig.test-config.myDefaultProperty', '').should.equal('hello'); + }); + }); + }); }); }); |