Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Unit tests written for Improving the Coverage #295

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

Kajol-Kumari
Copy link
Member

@Kajol-Kumari Kajol-Kumari commented Feb 21, 2020

Feat: #85

Feature: Unit Tests for written for improving coverage for following files:

  1. globalService
  2. endpointService
  3. challengeService
  4. authService
  5. apiService
  6. challengelist-component
  7. privacy-policy-component
  8. contact-component
  9. challenge-create-component
  10. verify-email-component
  11. signup-component
  12. reset-password-component
  13. reset-password-confirm-component
  14. login-component
  15. auth-component
  16. host-analytics-component
  17. analytics-component
  18. about-component
  19. app-component
  20. teamlist-component

@codecov-io
Copy link

codecov-io commented Feb 21, 2020

Codecov Report

Merging #295 into master will increase coverage by 14.58%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master     #295       +/-   ##
===========================================
+ Coverage   50.62%   65.20%   +14.58%     
===========================================
  Files          66       66               
  Lines        3771     3771               
  Branches      444      444               
===========================================
+ Hits         1909     2459      +550     
+ Misses       1767     1186      -581     
- Partials       95      126       +31     
Impacted Files Coverage Δ
src/app/services/endpoints.service.ts 97.87% <100.00%> (+32.97%) ⬆️
src/app/components/auth/auth.component.ts 100.00% <0.00%> (+6.66%) ⬆️
...lengelist/challengecard/challengecard.component.ts 81.66% <0.00%> (+6.66%) ⬆️
src/app/components/contact/contact.component.ts 90.90% <0.00%> (+12.12%) ⬆️
src/app/services/challenge.service.ts 62.17% <0.00%> (+16.02%) ⬆️
...ponents/privacy-policy/privacy-policy.component.ts 86.11% <0.00%> (+16.66%) ⬆️
src/app/services/api.service.ts 90.47% <0.00%> (+22.22%) ⬆️
src/app/services/global.service.ts 67.38% <0.00%> (+29.18%) ⬆️
src/app/components/auth/signup/signup.component.ts 77.61% <0.00%> (+32.83%) ⬆️
... and 9 more
Impacted Files Coverage Δ
src/app/services/endpoints.service.ts 97.87% <100.00%> (+32.97%) ⬆️
src/app/components/auth/auth.component.ts 100.00% <0.00%> (+6.66%) ⬆️
...lengelist/challengecard/challengecard.component.ts 81.66% <0.00%> (+6.66%) ⬆️
src/app/components/contact/contact.component.ts 90.90% <0.00%> (+12.12%) ⬆️
src/app/services/challenge.service.ts 62.17% <0.00%> (+16.02%) ⬆️
...ponents/privacy-policy/privacy-policy.component.ts 86.11% <0.00%> (+16.66%) ⬆️
src/app/services/api.service.ts 90.47% <0.00%> (+22.22%) ⬆️
src/app/services/global.service.ts 67.38% <0.00%> (+29.18%) ⬆️
src/app/components/auth/signup/signup.component.ts 77.61% <0.00%> (+32.83%) ⬆️
... and 9 more

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 d3d23ca...52e131f. Read the comment docs.

@Kajol-Kumari
Copy link
Member Author

@Sanji515 SIr, Can you please take a look at the unit tests i have written. I am not sure whether i am doing it correctly or not as i am just a begineer in writing tests. If it's fine i'll continue writing tests for the other services and components and if not then i will work on improving the tests i have written till now.

@Kajol-Kumari Kajol-Kumari marked this pull request as ready for review February 24, 2020 14:46
@Kajol-Kumari Kajol-Kumari changed the title Testing the unit tests written for Services Unit tests written for Improving the Coverage Feb 28, 2020
Copy link
Member

@Shekharrajak Shekharrajak left a comment

Choose a reason for hiding this comment

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

From next time try to make small PRs - a specific code change , so that we can review it quickly. For now it is fine.

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2020

Codecov Report

Merging #295 into master will increase coverage by 14.30%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master     #295       +/-   ##
===========================================
+ Coverage   50.16%   64.47%   +14.30%     
===========================================
  Files          66       66               
  Lines        3873     3873               
  Branches      450      450               
===========================================
+ Hits         1943     2497      +554     
+ Misses       1836     1251      -585     
- Partials       94      125       +31     
Impacted Files Coverage Δ
src/app/services/endpoints.service.ts 95.91% <100.00%> (+31.63%) ⬆️
src/app/components/auth/auth.component.ts 100.00% <0.00%> (+6.66%) ⬆️
...lengelist/challengecard/challengecard.component.ts 81.66% <0.00%> (+6.66%) ⬆️
src/app/components/contact/contact.component.ts 90.90% <0.00%> (+12.12%) ⬆️
src/app/services/challenge.service.ts 62.42% <0.00%> (+15.28%) ⬆️
...ponents/privacy-policy/privacy-policy.component.ts 86.11% <0.00%> (+16.66%) ⬆️
src/app/services/api.service.ts 90.47% <0.00%> (+22.22%) ⬆️
src/app/services/global.service.ts 66.95% <0.00%> (+28.75%) ⬆️
src/app/components/auth/signup/signup.component.ts 77.61% <0.00%> (+32.83%) ⬆️
... and 9 more
Impacted Files Coverage Δ
src/app/services/endpoints.service.ts 95.91% <100.00%> (+31.63%) ⬆️
src/app/components/auth/auth.component.ts 100.00% <0.00%> (+6.66%) ⬆️
...lengelist/challengecard/challengecard.component.ts 81.66% <0.00%> (+6.66%) ⬆️
src/app/components/contact/contact.component.ts 90.90% <0.00%> (+12.12%) ⬆️
src/app/services/challenge.service.ts 62.42% <0.00%> (+15.28%) ⬆️
...ponents/privacy-policy/privacy-policy.component.ts 86.11% <0.00%> (+16.66%) ⬆️
src/app/services/api.service.ts 90.47% <0.00%> (+22.22%) ⬆️
src/app/services/global.service.ts 66.95% <0.00%> (+28.75%) ⬆️
src/app/components/auth/signup/signup.component.ts 77.61% <0.00%> (+32.83%) ⬆️
... and 9 more

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 932a9c0...28f265f. Read the comment docs.

@@ -53,4 +53,12 @@ describe('AnalyticsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

it('should call ngOninit', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to test more lines than the trivial component cases?

expect(service.getUrl).toHaveBeenCalled();
expect(service3.teamCountAnalyticsURL).toHaveBeenCalled();
}));
it('should show download challenge participant team', inject([EndpointsService, ApiService],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
it('should show download challenge participant team', inject([EndpointsService, ApiService],
it('should download challenge participant team', inject([EndpointsService, ApiService],

expect(endpointsService.updateChallengePhaseDetailsURL(2, 3)).toBe('challenges/challenge/2/challenge_phase/3');
});
it('should return challenge phase split url' , () => {
expect(endpointsService.challengePhaseSplitURL(2)).toBe('challenges/2/challenge_phase_split');
Copy link
Member

Choose a reason for hiding this comment

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

Whenever possible, try not to hardcode URLs. Make them variables at the top and use them.

Copy link
Member

@lunayach lunayach left a comment

Choose a reason for hiding this comment

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

Overall, great job @Kajol-Kumari! At some places, I felt more lines in the code could be tested and we might boost the test coverage a little more. Since this is not the top priority for now, you could add more tests a little later when you can.

@Sanji515
Copy link
Member

@Kajol-Kumari Can you please check why the build is failing here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants