-
Notifications
You must be signed in to change notification settings - Fork 10
Unit Test Coverage on Angular Services and Providers #6
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
Conversation
@bsouthga Ship is ready for sail. Ready for review. |
@kanhirun this looks great! thanks for adding code coverage + a few more tests. 👏 There is only one issue I see to take a look at before merging this in -- when I use this branch with our current app, it I get the
Error, as it looks like the new order of the concatenated files causes the run statement to occur before the config registration. Maybe take a look at that? It also might make sense to add a real |
@kanhirun the filenames look good to me, don't yet have a nailed down standard. |
* Re-generates build artifact * Moves angular components into separate files. This improves the testability of angular services such that the configuration, and run phase can be tested independently
This provides better test feedback on readability, and allows using Karma's --grep option easily.
@bsouthga I made changes based on your feedback and tested it end-to-end with the angular-seed app. Thanks again for bringing this to my attention. The issue wasn't just that the run statement occurred before config, but that both Ultimately, I decided to just merge the two back into the same file. (After all, my testing requirement was just to keep the run statement by itself.) If you want to take a different approach, I'll lean on your expertise here. Here are some other solutions:
Either way, this is ready for another review (and to be re-tested on your end) |
Awesome! looks good to me -- I think keeping the two in the same file is fine for now. If we did want to move them to separate files, we could try injecting the settings into the provider like this: angular.module('zendeskWidget')
.provider('ZendeskWidget', ['zendeskWidgetSettings', function(settings) {
//... do stuff
}); Overall great work 👍 -- appreciate your thoroughness and desire for implementing refactoring best practices! |
@bsouthga Great! I'll leave it to you to press the big ✅ button then. EDIT: To my understanding, |
Your totally right, my mistake -- I think keeping the two in the same file is fine for now. Merged! |
Summary
zendeskWidgetSettings
, andZendeskWidgetProvider
(4d95fcc) (See Figure 1 below)integration/
andunit/
(see Figure 2 below)Figure 1. Unit Test Coverage Report
Missing 6.25% is due to Self-Executing Anonymous Function [LOC]
Figure 2. The
test/
is reorganized to expose two distinct layers