mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 02:23:30 +00:00
Adapt tests for config modifiers
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user