adding tests for Android Studio

This closes #331


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

Branch: refs/heads/master
Commit: f5ab6fc60203c54c4f4a7319a716d4c35ef1b326
Parents: 222fb1c
Author: Anis Kadri <a...@apache.org>
Authored: Fri Sep 16 15:41:20 2016 -0700
Committer: Joe Bowser <bows...@apache.org>
Committed: Tue Sep 20 19:54:38 2016 -0700

----------------------------------------------------------------------
 spec/unit/pluginHandlers/handlers.spec.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f5ab6fc6/spec/unit/pluginHandlers/handlers.spec.js
----------------------------------------------------------------------
diff --git a/spec/unit/pluginHandlers/handlers.spec.js 
b/spec/unit/pluginHandlers/handlers.spec.js
index 08a6275..be7b95b 100644
--- a/spec/unit/pluginHandlers/handlers.spec.js
+++ b/spec/unit/pluginHandlers/handlers.spec.js
@@ -64,6 +64,10 @@ describe('android project handler', function() {
                 android['lib-file'].install(valid_libs[0], dummyPluginInfo, 
dummyProject);
                 expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 
'src/android/TestLib.jar', temp, path.join('libs', 'TestLib.jar'), false);
             });
+            it('should copy files for Android Studio projects', function () {
+                android['lib-file'].install(valid_libs[0], dummyPluginInfo, 
dummyProject, {android_studio: true});
+                expect(copyFileSpy).toHaveBeenCalledWith(dummyplugin, 
'src/android/TestLib.jar', temp, path.join('app', 'libs', 'TestLib.jar'), 
false);
+            });
         });
 
         describe('of <resource-file> elements', function() {
@@ -84,6 +88,12 @@ describe('android project handler', function() {
                     .toHaveBeenCalledWith(dummyplugin, 
'src/android/DummyPlugin.java', temp, 
path.join('src/com/phonegap/plugins/dummyplugin/DummyPlugin.java'), false);
             });
 
+            it('should install source files to the right location for Android 
Studio projects', function() {
+                android['source-file'].install(valid_source[0], 
dummyPluginInfo, dummyProject, {android_studio: true});
+                expect(copyFileSpy)
+                    .toHaveBeenCalledWith(dummyplugin, 
'src/android/DummyPlugin.java', temp, 
path.join('app/src/main/java/com/phonegap/plugins/dummyplugin/DummyPlugin.java'),
 false);
+            });
+
             it('should throw if source file cannot be found', function() {
                 common.__set__('copyFile', copyFileOrig);
                 expect(function() {
@@ -240,6 +250,11 @@ describe('android project handler', function() {
                 android['lib-file'].uninstall(valid_libs[0], dummyPluginInfo, 
dummyProject);
                 expect(removeFileSpy).toHaveBeenCalledWith(temp, 
path.join('libs/TestLib.jar'));
             });
+            it('should remove jar files for Android Studio projects', function 
() {
+                android['lib-file'].install(valid_libs[0], dummyPluginInfo, 
dummyProject, {android_studio:true});
+                android['lib-file'].uninstall(valid_libs[0], dummyPluginInfo, 
dummyProject, {android_studio:true});
+                expect(removeFileSpy).toHaveBeenCalledWith(temp, 
path.join('app/libs/TestLib.jar'));
+            });
         });
 
         describe('of <resource-file> elements', function(done) {
@@ -256,6 +271,11 @@ describe('android project handler', function() {
                 android['source-file'].uninstall(valid_source[0], 
dummyPluginInfo, dummyProject);
                 expect(deleteJavaSpy).toHaveBeenCalledWith(temp, 
path.join('src/com/phonegap/plugins/dummyplugin/DummyPlugin.java'));
             });
+            it('should remove stuff by calling common.deleteJava for Android 
Studio projects', function() {
+                android['source-file'].install(valid_source[0], 
dummyPluginInfo, dummyProject, {android_studio:true});
+                android['source-file'].uninstall(valid_source[0], 
dummyPluginInfo, dummyProject, {android_studio:true});
+                expect(deleteJavaSpy).toHaveBeenCalledWith(temp, 
path.join('app/src/main/java/com/phonegap/plugins/dummyplugin/DummyPlugin.java'));
+            });
         });
 
         describe('of <framework> elements', function() {


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

Reply via email to