From f8584c63e6df858470de692791e7f993f2706df6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Brody" Date: Fri, 9 Nov 2018 14:43:47 -0500 Subject: [PATCH] unit test source-file with custom lib target-dir (PR #542) for JAR and AAR (GH-540) Co-Authored-By: Kyle Kirbatski Co-Authored-By: Christopher J. Brody Co-Authored-By: @afdev82 (Antonio Facciolo) --- .../org.test.plugins.dummyplugin/plugin.xml | 4 ++++ .../src/android/TestAar.aar | 1 + spec/unit/pluginHandlers/handlers.spec.js | 13 +++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 spec/fixtures/org.test.plugins.dummyplugin/src/android/TestAar.aar diff --git a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml index 5451ef8d..b299b645 100644 --- a/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml +++ b/spec/fixtures/org.test.plugins.dummyplugin/plugin.xml @@ -72,6 +72,10 @@ target-dir="src/com/phonegap/plugins/dummyplugin" /> + + diff --git a/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestAar.aar b/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestAar.aar new file mode 100644 index 00000000..ce401543 --- /dev/null +++ b/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestAar.aar @@ -0,0 +1 @@ +./org.test.plugins.dummyplugin/src/android/TestAar.aar diff --git a/spec/unit/pluginHandlers/handlers.spec.js b/spec/unit/pluginHandlers/handlers.spec.js index 206de56e..1baf3977 100644 --- a/spec/unit/pluginHandlers/handlers.spec.js +++ b/spec/unit/pluginHandlers/handlers.spec.js @@ -114,6 +114,19 @@ describe('android project handler', function () { expect(copyFileSpy) .toHaveBeenCalledWith(dummyplugin, 'src/android/DummyPlugin2.java', temp, path.join('app/src/main/src/com/phonegap/plugins/dummyplugin/DummyPlugin2.java'), false); }); + + // TODO: renumber these tests and other tests below + it('Test#007a : should allow installing lib file from sources using proper path', function () { + android['source-file'].install(valid_source[2], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy) + .toHaveBeenCalledWith(dummyplugin, 'src/android/TestLib.jar', temp, path.join('app/libs/TestLib.jar'), false); + }); + + it('Test#007b : should allow installing aar file from sources using proper path', function () { + android['source-file'].install(valid_source[3], dummyPluginInfo, dummyProject, {android_studio: true}); + expect(copyFileSpy) + .toHaveBeenCalledWith(dummyplugin, 'src/android/TestAar.aar', temp, path.join('app/libs/TestAar.aar'), false); + }); }); describe('of elements', function () {