summaryrefslogtreecommitdiffstats
path: root/lib/plugins/__tests__
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-05-02 22:02:45 +0200
committerSamy Pesse <samypesse@gmail.com>2016-05-02 22:02:45 +0200
commit41e687255717c43d1bf2745e7b806057c7de16ae (patch)
tree6be8992936b0c0ec006fc46d5f7577791494aba1 /lib/plugins/__tests__
parent8de0d6186e8a10cdd5a3efe9a4cf0afcae734223 (diff)
parent30c96c37c2145a28710e2875c677d37156fdaa92 (diff)
downloadgitbook-41e687255717c43d1bf2745e7b806057c7de16ae.zip
gitbook-41e687255717c43d1bf2745e7b806057c7de16ae.tar.gz
gitbook-41e687255717c43d1bf2745e7b806057c7de16ae.tar.bz2
Merge branch 'fix/plugins_deps'
Diffstat (limited to 'lib/plugins/__tests__')
-rw-r--r--lib/plugins/__tests__/listAll.js53
1 files changed, 9 insertions, 44 deletions
diff --git a/lib/plugins/__tests__/listAll.js b/lib/plugins/__tests__/listAll.js
index 71483a7..f9711a7 100644
--- a/lib/plugins/__tests__/listAll.js
+++ b/lib/plugins/__tests__/listAll.js
@@ -1,21 +1,10 @@
-jest.autoMockOff();
+var PluginDependency = require('../../models/pluginDependency');
+var listAll = require('../listAll');
describe('listAll', function() {
- var listAll = require('../listAll');
-
- it('must list from string', function() {
- var plugins = listAll('ga,great');
-
- expect(plugins.size).toBe(8);
-
- expect(plugins.has('ga')).toBe(true);
- expect(plugins.has('great')).toBe(true);
-
- expect(plugins.has('search')).toBe(true);
- });
-
- it('must list from array', function() {
- var plugins = listAll(['ga', 'great']);
+ it('must list default', function() {
+ var deps = PluginDependency.listFromString('ga,great');
+ var plugins = listAll(deps);
expect(plugins.size).toBe(8);
@@ -25,34 +14,9 @@ describe('listAll', function() {
expect(plugins.has('search')).toBe(true);
});
- it('must parse version (semver)', function() {
- var plugins = listAll(['ga@1.0.0', 'great@>=4.0.0']);
-
- expect(plugins.has('ga')).toBe(true);
- expect(plugins.has('great')).toBe(true);
-
- var ga = plugins.get('ga');
- expect(ga.getVersion()).toBe('1.0.0');
-
- var great = plugins.get('great');
- expect(great.getVersion()).toBe('>=4.0.0');
- });
-
- it('must parse version (git)', function() {
- var plugins = listAll(['ga@git+https://github.com/GitbookIO/plugin-ga.git', 'great@git+ssh://samy@github.com/GitbookIO/plugin-ga.git']);
-
- expect(plugins.has('ga')).toBe(true);
- expect(plugins.has('great')).toBe(true);
-
- var ga = plugins.get('ga');
- expect(ga.getVersion()).toBe('git+https://github.com/GitbookIO/plugin-ga.git');
-
- var great = plugins.get('great');
- expect(great.getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
- });
-
it('must list from array with -', function() {
- var plugins = listAll(['ga', '-great']);
+ var deps = PluginDependency.listFromString('ga,-great');
+ var plugins = listAll(deps);
expect(plugins.size).toBe(7);
@@ -61,7 +25,8 @@ describe('listAll', function() {
});
it('must remove default plugins using -', function() {
- var plugins = listAll(['ga', '-search']);
+ var deps = PluginDependency.listFromString('ga,-search');
+ var plugins = listAll(deps);
expect(plugins.size).toBe(6);