mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 11:03:39 +00:00
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
var PluginDependency = require('../../models/pluginDependency');
|
|
var sortPlugins = require('../sortPlugins');
|
|
var listAll = require('../listAll');
|
|
|
|
describe('sortPlugins', function() {
|
|
it('must load themes after plugins', function() {
|
|
var deps = PluginDependency.listFromString('theme-faq'),
|
|
allPlugins = listAll(deps);
|
|
|
|
var sorted = sortPlugins(allPlugins, []);
|
|
var names = sorted
|
|
.map(function(plugin) {
|
|
return plugin.getName();
|
|
})
|
|
.toArray();
|
|
|
|
expect(names).toEqual([
|
|
'fontsettings',
|
|
'sharing',
|
|
'lunr',
|
|
'search',
|
|
'highlight',
|
|
'theme-faq',
|
|
'theme-default'
|
|
]);
|
|
});
|
|
|
|
it('must load themes after plugins with a complex dependencies list', function() {
|
|
var deps = PluginDependency.listFromString('comment,theme-faq,-search,ga'),
|
|
allPlugins = listAll(deps);
|
|
|
|
var sorted = sortPlugins(allPlugins, []);
|
|
var names = sorted
|
|
.map(function(plugin) {
|
|
return plugin.getName();
|
|
})
|
|
.toArray();
|
|
|
|
expect(names).toEqual([
|
|
'ga',
|
|
'comment',
|
|
'fontsettings',
|
|
'sharing',
|
|
'lunr',
|
|
'highlight',
|
|
'theme-faq',
|
|
'theme-default'
|
|
]);
|
|
});
|
|
}); |