diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-06-06 17:27:47 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-06-06 17:27:47 +0200 |
commit | 30fbd22efe117f459873599311f16a2e7394aa52 (patch) | |
tree | d7b32b3ad7ade7b155c488f8b33afb2532b29696 /lib/modifiers/config/__tests__ | |
parent | 29df73ba72cedc6ff66843dad59ffded9d4aa01b (diff) | |
download | gitbook-30fbd22efe117f459873599311f16a2e7394aa52.zip gitbook-30fbd22efe117f459873599311f16a2e7394aa52.tar.gz gitbook-30fbd22efe117f459873599311f16a2e7394aa52.tar.bz2 |
Add modifier togglePlugin
Diffstat (limited to 'lib/modifiers/config/__tests__')
-rw-r--r-- | lib/modifiers/config/__tests__/togglePlugin.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/modifiers/config/__tests__/togglePlugin.js b/lib/modifiers/config/__tests__/togglePlugin.js new file mode 100644 index 0000000..4ac088b --- /dev/null +++ b/lib/modifiers/config/__tests__/togglePlugin.js @@ -0,0 +1,32 @@ +var togglePlugin = require('../togglePlugin'); +var Config = require('../../../models/config'); +var Book = require('../../../models/book'); + +describe('togglePlugin', function() { + var config = Config.createWithValues({ + plugins: ['hello', 'world', '-disabled'] + }); + var book = Book().setConfig(config); + + it('should enable plugin', function() { + var newBook = togglePlugin(book, 'disabled'); + var newConfig = newBook.getConfig(); + + var testDep = newConfig.getPluginDependency('disabled'); + expect(testDep).toBeDefined(); + expect(testDep.getVersion()).toEqual('*'); + expect(testDep.isEnabled()).toBeTruthy(); + }); + + it('should disable plugin', function() { + var newBook = togglePlugin(book, 'world'); + var newConfig = newBook.getConfig(); + + var testDep = newConfig.getPluginDependency('world'); + expect(testDep).toBeDefined(); + expect(testDep.getVersion()).toEqual('*'); + expect(testDep.isEnabled()).toBeFalsy(); + }); +}); + + |