Skip to content

Commit

Permalink
unit test source-file with custom lib target-dir (PR apache#542)
Browse files Browse the repository at this point in the history
for JAR and AAR

(apacheGH-540)

Co-Authored-By: Kyle Kirbatski <kkirbatski@gmrmarketing.com>
Co-Authored-By: Christopher J. Brody <chris.brody@gmail.com>
Co-Authored-By: @afdev82 (Antonio Facciolo)
  • Loading branch information
Christopher J. Brody and kkirby committed Nov 16, 2018
1 parent 52e9842 commit 56a925f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/fixtures/org.test.plugins.dummyplugin/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
target-dir="src/com/phonegap/plugins/dummyplugin" />
<source-file src="src/android/DummyPlugin2.java"
target-dir="app/src/main/src/com/phonegap/plugins/dummyplugin" />
<source-file src="src/android/TestLib.jar"
target-dir="app/libs" />
<source-file src="src/android/TestAar.aar"
target-dir="app/libs" />
<lib-file src="src/android/TestLib.jar" />
</platform>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./org.test.plugins.dummyplugin/src/android/TestAar.aar
13 changes: 13 additions & 0 deletions spec/unit/pluginHandlers/handlers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <framework> elements', function () {
Expand Down

0 comments on commit 56a925f

Please sign in to comment.