diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2014-04-21 14:26:09 -0700 |
---|---|---|
committer | Aaron O'Mullan <aaron.omullan@gmail.com> | 2014-04-21 14:26:09 -0700 |
commit | 4c90fdb7b27fdf6527b59097d489a9df0a929264 (patch) | |
tree | b00f3196f58ed712dea40dd69a261fc43129a651 /test/plugin.js | |
parent | d1c1d7b75b6e4a304d031c4313cf54ae8aa3a11d (diff) | |
parent | 98c133df3c9077c1b06748c3206bea3ff011ed3a (diff) | |
download | gitbook-4c90fdb7b27fdf6527b59097d489a9df0a929264.zip gitbook-4c90fdb7b27fdf6527b59097d489a9df0a929264.tar.gz gitbook-4c90fdb7b27fdf6527b59097d489a9df0a929264.tar.bz2 |
Merge pull request #123 from GitbookIO/feature/plugins
Fix #65: Plugins Architecture
Diffstat (limited to 'test/plugin.js')
-rw-r--r-- | test/plugin.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/plugin.js b/test/plugin.js new file mode 100644 index 0000000..518ea3c --- /dev/null +++ b/test/plugin.js @@ -0,0 +1,49 @@ +var _ = require('lodash'); +var path = require('path'); +var assert = require('assert'); + +var Plugin = require('../').generate.Plugin; + +describe('Plugin validation', function () { + var plugin = new Plugin("gitbook-plugin"); + + it('should be valid', function() { + assert(plugin.isValid()); + }); +}); + +describe('Plugin list of names', function () { + var firstDefault = _.first(Plugin.defaults); + + it('should convert string to array', function() { + var _name = "test"; + assert(_.contains(Plugin.normalizeNames(_name), _name)); + }); + + it('should contains default plugins', function() { + assert(_.contains(Plugin.normalizeNames([]), firstDefault)); + }); + + it('should remove name starting with -', function() { + assert(!_.contains(Plugin.normalizeNames(["-"+firstDefault]), firstDefault)); + }); +}); + +describe('Plugin defaults loading', function () { + var ret = true; + + beforeEach(function(done){ + Plugin.fromList(Plugin.defaults) + .then(function(_r) { + ret = _r; + }, function(err) { + ret = null; + }) + .fin(done); + }); + + + it('should load defaults addons', function() { + assert(ret != null); + }); +}); |