Adapt tests for config modifiers

This commit is contained in:
Samy Pesse
2016-06-06 21:22:44 +02:00
parent 0baebc7979
commit 23010fa54a
2 changed files with 3 additions and 10 deletions
+1 -4
View File
@@ -1,12 +1,10 @@
var addPlugin = require('../addPlugin');
var Config = require('../../../models/config');
var Book = require('../../../models/book');
describe('addPlugin', function() {
var config = Config.createWithValues({
plugins: ['hello', 'world', '-disabled']
});
var book = Book().setConfig(config);
it('should have correct state of dependencies', function() {
var disabledDep = config.getPluginDependency('disabled');
@@ -17,8 +15,7 @@ describe('addPlugin', function() {
});
it('should add the plugin to the list', function() {
var newBook = addPlugin(book, 'test');
var newConfig = newBook.getConfig();
var newConfig = addPlugin(config, 'test');
var testDep = newConfig.getPluginDependency('test');
expect(testDep).toBeDefined();
@@ -1,16 +1,13 @@
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 newConfig = togglePlugin(config, 'disabled');
var testDep = newConfig.getPluginDependency('disabled');
expect(testDep).toBeDefined();
@@ -19,8 +16,7 @@ describe('togglePlugin', function() {
});
it('should disable plugin', function() {
var newBook = togglePlugin(book, 'world');
var newConfig = newBook.getConfig();
var newConfig = togglePlugin(config, 'world');
var testDep = newConfig.getPluginDependency('world');
expect(testDep).toBeDefined();