From b23d3a9f37a225eb418967a19c4ddddbf8a76c63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Mon, 22 Feb 2016 10:16:38 +0100 Subject: [PATCH] Add test for extension of book's configuration --- test/plugins.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/plugins.js b/test/plugins.js index a525a7bfa..4fd59d420 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'); + }); + }); + }); }); });