summaryrefslogtreecommitdiffstats
path: root/lib/models/__tests__/pluginDependency.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
committerSamy Pessé <samypesse@gmail.com>2016-09-05 11:04:18 +0200
commita14ca3e268e95a7eab59fb205b41da7331d57631 (patch)
tree9c84b2cbd561345335fca3e26af961b2ea23d8ec /lib/models/__tests__/pluginDependency.js
parent9c071dade573aa6990878006f83c89b6065a1395 (diff)
downloadgitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.zip
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.gz
gitbook-a14ca3e268e95a7eab59fb205b41da7331d57631.tar.bz2
Switch to lerna
Diffstat (limited to 'lib/models/__tests__/pluginDependency.js')
-rw-r--r--lib/models/__tests__/pluginDependency.js80
1 files changed, 0 insertions, 80 deletions
diff --git a/lib/models/__tests__/pluginDependency.js b/lib/models/__tests__/pluginDependency.js
deleted file mode 100644
index cb04cf2..0000000
--- a/lib/models/__tests__/pluginDependency.js
+++ /dev/null
@@ -1,80 +0,0 @@
-var Immutable = require('immutable');
-var PluginDependency = require('../pluginDependency');
-
-describe('PluginDependency', function() {
- describe('createFromString', function() {
- it('must parse name', function() {
- var plugin = PluginDependency.createFromString('hello');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.getVersion()).toBe('*');
- });
-
- it('must parse state', function() {
- var plugin = PluginDependency.createFromString('-hello');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.isEnabled()).toBe(false);
- });
-
- describe('Version', function() {
- it('must parse version', function() {
- var plugin = PluginDependency.createFromString('hello@1.0.0');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.getVersion()).toBe('1.0.0');
- });
-
- it('must parse semver', function() {
- var plugin = PluginDependency.createFromString('hello@>=4.0.0');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.getVersion()).toBe('>=4.0.0');
- });
- });
-
- describe('GIT Version', function() {
- it('must handle HTTPS urls', function() {
- var plugin = PluginDependency.createFromString('hello@git+https://github.com/GitbookIO/plugin-ga.git');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.getVersion()).toBe('git+https://github.com/GitbookIO/plugin-ga.git');
- });
-
- it('must handle SSH urls', function() {
- var plugin = PluginDependency.createFromString('hello@git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
- expect(plugin.getName()).toBe('hello');
- expect(plugin.getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
- });
- });
-
- describe('listToArray', function() {
- it('must create an array from a list of plugin dependencies', function() {
- var list = PluginDependency.listToArray(Immutable.List([
- PluginDependency.createFromString('hello@1.0.0'),
- PluginDependency.createFromString('noversion'),
- PluginDependency.createFromString('-disabled')
- ]));
-
- expect(list).toEqual([
- 'hello@1.0.0',
- 'noversion',
- '-disabled'
- ]);
- });
- });
-
- describe('listFromArray', function() {
- it('must create an array from a list of plugin dependencies', function() {
- var arr = Immutable.fromJS([
- 'hello@1.0.0',
- {
- 'name': 'plugin-ga',
- 'version': 'git+ssh://samy@github.com/GitbookIO/plugin-ga.git'
- }
- ]);
- var list = PluginDependency.listFromArray(arr);
-
- expect(list.first().getName()).toBe('hello');
- expect(list.first().getVersion()).toBe('1.0.0');
- expect(list.last().getName()).toBe('plugin-ga');
- expect(list.last().getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git');
- });
- });
- });
-});