summaryrefslogtreecommitdiffstats
path: root/lib/plugins/__tests__
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-06-10 22:08:16 +0200
committerSamy Pesse <samypesse@gmail.com>2016-06-10 22:08:16 +0200
commit1e3d871c1e288b58dc486053cc7fa0f274c4cf31 (patch)
tree5f221cb283e5f4591a3764112569ee62220e6da2 /lib/plugins/__tests__
parent50a132cb2c0b0666b3b067e32d37e10bfb9e50da (diff)
parent94a4310c1e4b9ee71def9cbd9efd8a4c491f4444 (diff)
downloadgitbook-1e3d871c1e288b58dc486053cc7fa0f274c4cf31.zip
gitbook-1e3d871c1e288b58dc486053cc7fa0f274c4cf31.tar.gz
gitbook-1e3d871c1e288b58dc486053cc7fa0f274c4cf31.tar.bz2
Merge branch 'fix/plugins_loading'
Diffstat (limited to 'lib/plugins/__tests__')
-rw-r--r--lib/plugins/__tests__/listDependencies.js (renamed from lib/plugins/__tests__/listAll.js)10
-rw-r--r--lib/plugins/__tests__/sortDependencies.js42
-rw-r--r--lib/plugins/__tests__/sortPlugins.js45
3 files changed, 47 insertions, 50 deletions
diff --git a/lib/plugins/__tests__/listAll.js b/lib/plugins/__tests__/listDependencies.js
index 6a08c84..940faba 100644
--- a/lib/plugins/__tests__/listAll.js
+++ b/lib/plugins/__tests__/listDependencies.js
@@ -1,11 +1,11 @@
var PluginDependency = require('../../models/pluginDependency');
-var listAll = require('../listAll');
+var listDependencies = require('../listDependencies');
var toNames = require('../toNames');
-describe('listAll', function() {
+describe('listDependencies', function() {
it('must list default', function() {
var deps = PluginDependency.listFromString('ga,great');
- var plugins = listAll(deps);
+ var plugins = listDependencies(deps);
var names = toNames(plugins);
expect(names).toEqual([
@@ -16,7 +16,7 @@ describe('listAll', function() {
it('must list from array with -', function() {
var deps = PluginDependency.listFromString('ga,-great');
- var plugins = listAll(deps);
+ var plugins = listDependencies(deps);
var names = toNames(plugins);
expect(names).toEqual([
@@ -27,7 +27,7 @@ describe('listAll', function() {
it('must remove default plugins using -', function() {
var deps = PluginDependency.listFromString('ga,-search');
- var plugins = listAll(deps);
+ var plugins = listDependencies(deps);
var names = toNames(plugins);
expect(names).toEqual([
diff --git a/lib/plugins/__tests__/sortDependencies.js b/lib/plugins/__tests__/sortDependencies.js
new file mode 100644
index 0000000..87df477
--- /dev/null
+++ b/lib/plugins/__tests__/sortDependencies.js
@@ -0,0 +1,42 @@
+var PluginDependency = require('../../models/pluginDependency');
+var sortDependencies = require('../sortDependencies');
+var toNames = require('../toNames');
+
+describe('sortDependencies', function() {
+ it('must load themes after plugins', function() {
+ var allPlugins = PluginDependency.listFromArray([
+ 'hello',
+ 'theme-test',
+ 'world'
+ ]);
+
+ var sorted = sortDependencies(allPlugins);
+ var names = toNames(sorted);
+
+ expect(names).toEqual([
+ 'hello',
+ 'world',
+ 'theme-test'
+ ]);
+ });
+
+ it('must keep order of themes', function() {
+ var allPlugins = PluginDependency.listFromArray([
+ 'theme-test',
+ 'theme-test1',
+ 'hello',
+ 'theme-test2',
+ 'world'
+ ]);
+ var sorted = sortDependencies(allPlugins);
+ var names = toNames(sorted);
+
+ expect(names).toEqual([
+ 'hello',
+ 'world',
+ 'theme-test',
+ 'theme-test1',
+ 'theme-test2'
+ ]);
+ });
+}); \ No newline at end of file
diff --git a/lib/plugins/__tests__/sortPlugins.js b/lib/plugins/__tests__/sortPlugins.js
deleted file mode 100644
index 4aa26a3..0000000
--- a/lib/plugins/__tests__/sortPlugins.js
+++ /dev/null
@@ -1,45 +0,0 @@
-var Immutable = require('immutable');
-
-var Plugin = require('../../models/plugin');
-var sortPlugins = require('../sortPlugins');
-var toNames = require('../toNames');
-
-describe('sortPlugins', function() {
- it('must load themes after plugins', function() {
- var allPlugins = Immutable.OrderedMap([
- ['hello', Plugin.createFromString('hello')],
- ['theme-test', Plugin.createFromString('theme-test')],
- ['world', Plugin.createFromString('world')]
- ]);
-
- var sorted = sortPlugins(allPlugins);
- var names = toNames(sorted);
-
- expect(names).toEqual([
- 'hello',
- 'world',
- 'theme-test'
- ]);
- });
-
- it('must keep order of themes', function() {
- var allPlugins = Immutable.OrderedMap([
- ['theme-test', Plugin.createFromString('theme-test')],
- ['theme-test1', Plugin.createFromString('theme-test1')],
- ['hello', Plugin.createFromString('hello')],
- ['theme-test2', Plugin.createFromString('theme-test2')],
- ['world', Plugin.createFromString('world')]
- ]);
-
- var sorted = sortPlugins(allPlugins);
- var names = toNames(sorted);
-
- expect(names).toEqual([
- 'hello',
- 'world',
- 'theme-test',
- 'theme-test1',
- 'theme-test2'
- ]);
- });
-}); \ No newline at end of file