Emulator: Add unit tests and remove Q #463
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 offin
orfinally
are all in tests, and most of them were inemulator.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 usedone
, but they could be identically replaced withthen
orcatch
.There is probably some refactoring that could be done on
emulator.js
. Theinstall
function has custom functionality due to an old ticket which references Android 2.2 (!). I reckon this could be refactored to useAdb.install
, but I have left it alone for now.What testing has been done on this change?
Checklist