diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-17 12:55:46 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-17 12:55:46 +0100 |
commit | e95678cf3a3cfbcbfa8b64ca16c4030417187e88 (patch) | |
tree | df580b97ac58bef29a81dee32c76342062b1c70f /test/plugins.js | |
parent | e2c21051aa6a42f13208297d08688b99d45ddb27 (diff) | |
download | gitbook-e95678cf3a3cfbcbfa8b64ca16c4030417187e88.zip gitbook-e95678cf3a3cfbcbfa8b64ca16c4030417187e88.tar.gz gitbook-e95678cf3a3cfbcbfa8b64ca16c4030417187e88.tar.bz2 |
Add tests for installation of plugins
Diffstat (limited to 'test/plugins.js')
-rw-r--r-- | test/plugins.js | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/test/plugins.js b/test/plugins.js index 81c099e..47f9314 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -1,6 +1,7 @@ var mock = require('./mock'); var registry = require('../lib/plugins/registry'); var Output = require('../lib/output/base'); +var PluginsManager = require('../lib/plugins'); describe('Plugins', function() { var book; @@ -19,6 +20,15 @@ describe('Plugins', function() { }); }); + describe('Loading', function() { + it('should load default plugins', function() { + return mock.outputDefaultBook(Output) + .then(function(output) { + output.plugins.count().should.be.greaterThan(0); + }); + }); + }); + describe('Installation', function() { it('should install a plugin from NPM without a specific version', function() { return registry.install(book, 'ga') @@ -29,15 +39,31 @@ describe('Plugins', function() { return registry.install(book, 'ga', '1.0.0') .should.be.fulfilled(); }); - }); - describe('Loading', function() { - it('should load default plugins', function() { - return mock.outputDefaultBook(Output) - .then(function(output) { - output.plugins.count().should.be.greaterThan(0); + it('should correctly install all dependencies (if none)', function() { + return mock.setupBook({}) + .then(function(book) { + var plugins = new PluginsManager(book); + return plugins.install() + .should.be.fulfilledWith(0); }); }); + + it('should correctly install all dependencies (if any)', function() { + return mock.setupBook({ + 'book.json': { + plugins: ['ga'] + } + }) + .then(function(book) { + return book.config.load() + .then(function() { + var plugins = new PluginsManager(book); + return plugins.install(); + }); + }) + .should.be.fulfilledWith(1); + }); }); }); |