summaryrefslogtreecommitdiffstats
path: root/packages/gitbook/src/plugins/__tests__/resolveVersion.js
blob: 949d078900984a112968bb28588dc750f610a543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const PluginDependency = require('../../models/pluginDependency');
const resolveVersion = require('../resolveVersion');

describe('resolveVersion', function() {
    it('must skip resolving and return non-semver versions', function() {
        const plugin = PluginDependency.createFromString('ga@git+ssh://samy@github.com/GitbookIO/plugin-ga.git');

        return resolveVersion(plugin)
        .then(function(version) {
            expect(version).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
        });
    });

    it('must resolve a normal plugin dependency', function() {
        const plugin = PluginDependency.createFromString('ga@>0.9.0 < 1.0.1');

        return resolveVersion(plugin)
        .then(function(version) {
            expect(version).toBe('1.0.0');
        });
    });
});