diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-06-07 11:06:53 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-06-07 11:06:53 +0200 |
commit | 67106e86981852d2d55830a8fca494c7d33eff37 (patch) | |
tree | b477ab3acb2b2db8f333e1e92a61432ae60dfb40 /lib/modifiers/config/__tests__/removePlugin.js | |
parent | dc2ab51a8812636143430459fab97027ad60ce23 (diff) | |
download | gitbook-67106e86981852d2d55830a8fca494c7d33eff37.zip gitbook-67106e86981852d2d55830a8fca494c7d33eff37.tar.gz gitbook-67106e86981852d2d55830a8fca494c7d33eff37.tar.bz2 |
Improve plugins config modifier
Diffstat (limited to 'lib/modifiers/config/__tests__/removePlugin.js')
-rw-r--r-- | lib/modifiers/config/__tests__/removePlugin.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/modifiers/config/__tests__/removePlugin.js b/lib/modifiers/config/__tests__/removePlugin.js new file mode 100644 index 0000000..253cc39 --- /dev/null +++ b/lib/modifiers/config/__tests__/removePlugin.js @@ -0,0 +1,33 @@ +var removePlugin = require('../removePlugin'); +var Config = require('../../../models/config'); + +describe('removePlugin', function() { + var config = Config.createWithValues({ + plugins: ['hello', 'world', '-disabled'] + }); + + it('should remove the plugin from the list', function() { + var newConfig = removePlugin(config, 'hello'); + + var testDep = newConfig.getPluginDependency('hello'); + expect(testDep).toNotBeDefined(); + }); + + it('should remove the disabled plugin from the list', function() { + var newConfig = removePlugin(config, 'disabled'); + + var testDep = newConfig.getPluginDependency('disabled'); + expect(testDep).toNotBeDefined(); + }); + + it('should disable default plugin', function() { + var newConfig = removePlugin(config, 'search'); + + var disabledDep = newConfig.getPluginDependency('search'); + expect(disabledDep).toBeDefined(); + expect(disabledDep.getVersion()).toEqual('*'); + expect(disabledDep.isEnabled()).toBeFalsy(); + }); +}); + + |