Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulator: Add unit tests and remove Q #463

Merged
merged 2 commits into from
Jul 3, 2018
Merged

Conversation

Menardi
Copy link
Contributor

@Menardi Menardi commented Jul 3, 2018

Platforms affected

Android

What does this PR do?

This is pretty much the same as the devices PR (#462). I have increased the test coverage for emulator.js (now at 89%). As with the devices PR, this also removes Q and replaces it with native Promises. It looks like all the uses of fin or finally are all in tests, and most of them were in emulator.spec.js. Refactoring the tests meant they were no longer necessary. The other thing to be aware of is other parts of Cordova expecting Q-like promises. In this case, a few other files were expecting to be able to use done, but they could be identically replaced with then or catch.

There is probably some refactoring that could be done on emulator.js. The install function has custom functionality due to an old ticket which references Android 2.2 (!). I reckon this could be refactored to use Adb.install, but I have left it alone for now.

What testing has been done on this change?

  • Ran emulator-related commands
  • Ran unit-tests

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

@Menardi Menardi changed the title Emulator tests Emulator: Add unit tests and remove Q Jul 3, 2018
@codecov-io
Copy link

Codecov Report

Merging #463 into master will increase coverage by 6.31%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #463      +/-   ##
==========================================
+ Coverage   52.03%   58.34%   +6.31%     
==========================================
  Files          17       17              
  Lines        1695     1695              
  Branches      312      312              
==========================================
+ Hits          882      989     +107     
+ Misses        813      706     -107
Impacted Files Coverage Δ
bin/templates/cordova/lib/emulator.js 89.61% <94.44%> (+41.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca8931c...d26c119. Read the comment docs.

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please make a JIRA ticket in the cordova-android component for someone to go back and review that 2.2-era code.

@dpogue dpogue merged commit b6e4598 into apache:master Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants