summaryrefslogtreecommitdiffstats
path: root/test/plugins.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-10-13 15:14:26 +0200
committerSamy Pessé <samypesse@gmail.com>2015-10-13 15:14:26 +0200
commit8ba18cd587de8f073c9818acbdeaeaafe9a478c1 (patch)
treee83f6a9b6e4a37d2058d11653db73123a799aef0 /test/plugins.js
parent4ae5b2e05001df9bdf8c5b64f8a82725e14d6414 (diff)
parent54c12fea89198ad6582529cf7bfd6c7ff6f92ed2 (diff)
downloadgitbook-8ba18cd587de8f073c9818acbdeaeaafe9a478c1.zip
gitbook-8ba18cd587de8f073c9818acbdeaeaafe9a478c1.tar.gz
gitbook-8ba18cd587de8f073c9818acbdeaeaafe9a478c1.tar.bz2
Merge pull request #979 from GitbookIO/feature/plugins_config
Improvements for plugin configurations
Diffstat (limited to 'test/plugins.js')
-rw-r--r--test/plugins.js33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/plugins.js b/test/plugins.js
index c0f2373..db2d225 100644
--- a/test/plugins.js
+++ b/test/plugins.js
@@ -51,6 +51,37 @@ describe('Plugins', function () {
});
});
+ describe('Configuration', function() {
+ var plugin;
+
+ before(function() {
+ plugin = new Plugin(book, 'testconfig');
+ plugin.load('./config', PLUGINS_ROOT);
+ });
+
+ it('should throw error for invalid configuration', function() {
+ return plugin.validateConfig({})
+ .should.be.rejectedWith('Configuration Error: pluginsConfig.testconfig.testRequired is required');
+ });
+
+ it('should throw error for invalid types', function() {
+ return plugin.validateConfig({
+ testRequired: 'hello'
+ })
+ .should.be.rejectedWith('Configuration Error: pluginsConfig.testconfig.testRequired is not of a type(s) number');
+ });
+
+ it('should extend with default values', function() {
+ return plugin.validateConfig({
+ testRequired: 12
+ })
+ .should.be.fulfilledWith({
+ hello: 'world',
+ testRequired: 12
+ });
+ });
+ });
+
describe('Resources', function() {
var plugin;
@@ -93,7 +124,7 @@ describe('Plugins', function () {
// There is resources from highlight plugin and this plugin
resources.css.should.have.lengthOf(2);
should.exist(_.find(resources.css, {
- path: './resources/test'
+ path: 'gitbook-plugin-resources/test'
}));
});
});