cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [13/14] cordova-lib git commit: plugin util specs implemented
Date Thu, 22 Jun 2017 17:34:44 GMT
plugin util specs implemented


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/ea8af455
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/ea8af455
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/ea8af455

Branch: refs/heads/master
Commit: ea8af4553d203a2a07731837a887f638a04f4f7d
Parents: 2daef35
Author: filmaj <maj.fil@gmail.com>
Authored: Wed Jun 21 09:39:51 2017 -0500
Committer: filmaj <maj.fil@gmail.com>
Committed: Wed Jun 21 14:58:42 2017 -0500

----------------------------------------------------------------------
 spec-cordova/plugin/util.spec.js | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/ea8af455/spec-cordova/plugin/util.spec.js
----------------------------------------------------------------------
diff --git a/spec-cordova/plugin/util.spec.js b/spec-cordova/plugin/util.spec.js
index f967706..b94412c 100644
--- a/spec-cordova/plugin/util.spec.js
+++ b/spec-cordova/plugin/util.spec.js
@@ -18,14 +18,36 @@
 */
 /* eslint-env jasmine */
 
-var plugin_util = require('../../src/cordova/plugin/util');
+var rewire = require('rewire');
+var plugin_util = rewire('../../src/cordova/plugin/util');
 
 describe('cordova/plugin/util', function () {
+    var plugin_info_mock = function () {};
+    var plugin_info_revert_mock;
+    beforeEach(function () {
+        plugin_info_mock.prototype = jasmine.createSpyObj('plugin info provider prototype
mock', ['getAllWithinSearchPath']);
+        plugin_info_revert_mock = plugin_util.__set__('PluginInfoProvider', plugin_info_mock);
+    });
+    afterEach(function () {
+        plugin_info_revert_mock();
+    });
     describe('getInstalledPlugins helper method', function () {
-        it('should return result of PluginInfoProvider\'s getAllWithinSearchPath method');
+        it('should return result of PluginInfoProvider\'s getAllWithinSearchPath method',
function () {
+            var plugins_list = ['VRPlugin', 'MastodonSocialPlugin'];
+            plugin_info_mock.prototype.getAllWithinSearchPath.and.returnValue(plugins_list);
+            expect(plugin_util.getInstalledPlugins('/some/path/to/a/project')).toEqual(plugins_list);
+        });
     });
     describe('saveToConfigXmlOn helper method', function () {
-        it('should return true if config.json\'s autosave option is truthy');
-        it('should return true if options passed in have a truthy save property');
+        it('should return true if config.json\'s autosave option is truthy', function ()
{
+            expect(plugin_util.saveToConfigXmlOn({
+                auto_save_plugins: true
+            })).toBe(true);
+        });
+        it('should return true if options passed in have a truthy save property', function
() {
+            expect(plugin_util.saveToConfigXmlOn({}, {
+                save: true
+            })).toBe(true);
+        });
     });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message