summaryrefslogtreecommitdiffstats
path: root/lib/plugins/__tests__/listDependencies.js
blob: 940faba4772ad4916dc42beaa9d800fc1c31e68c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var PluginDependency = require('../../models/pluginDependency');
var listDependencies = require('../listDependencies');
var toNames = require('../toNames');

describe('listDependencies', function() {
    it('must list default', function() {
        var deps = PluginDependency.listFromString('ga,great');
        var plugins = listDependencies(deps);
        var names = toNames(plugins);

        expect(names).toEqual([
            'ga', 'great',
            'highlight', 'search', 'lunr', 'sharing', 'fontsettings',
            'theme-default' ]);
    });

    it('must list from array with -', function() {
        var deps = PluginDependency.listFromString('ga,-great');
        var plugins = listDependencies(deps);
        var names = toNames(plugins);

        expect(names).toEqual([
            'ga',
            'highlight', 'search', 'lunr', 'sharing', 'fontsettings',
            'theme-default' ]);
    });

    it('must remove default plugins using -', function() {
        var deps = PluginDependency.listFromString('ga,-search');
        var plugins = listDependencies(deps);
        var names = toNames(plugins);

        expect(names).toEqual([
            'ga',
            'highlight', 'lunr', 'sharing', 'fontsettings',
            'theme-default' ]);
    });
});