diff options
Diffstat (limited to 'lib/models/__tests__/pluginDependency.js')
-rw-r--r-- | lib/models/__tests__/pluginDependency.js | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/lib/models/__tests__/pluginDependency.js b/lib/models/__tests__/pluginDependency.js index 0b105e9..cb04cf2 100644 --- a/lib/models/__tests__/pluginDependency.js +++ b/lib/models/__tests__/pluginDependency.js @@ -42,21 +42,39 @@ describe('PluginDependency', function() { expect(plugin.getVersion()).toBe('git+ssh://samy@github.com/GitbookIO/plugin-ga.git'); }); }); - }); - describe('listToArray', 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('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'); + }); + }); + }); +}); |