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

fix: improve code coverage for src/screens/OrgPost/OrgPost.test.tsx #1165

Merged
merged 2 commits into from
Dec 10, 2023

Conversation

meetulr
Copy link
Contributor

@meetulr meetulr commented Dec 8, 2023

What kind of change does this PR introduce?

Added code coverage for src/screens/OrgPost/OrgPost.test.tsx

Issue Number:

Fixes #1136
Fixes #1029

Did you add tests for your changes?

Yes

Does this PR introduce a breaking change?

No

Have you read the contributing guide?

Yes

Copy link

github-actions bot commented Dec 8, 2023

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

@aashimawadhwa
Copy link
Member

Thanks.

Please also get the test code coverage for the typescript files you edited up to 100%

We are trying to get back up to 95% coverage overall to ensure the reliability of our code.
@meetulr

@meetulr
Copy link
Contributor Author

meetulr commented Dec 9, 2023

Thanks.

Please also get the test code coverage for the typescript files you edited up to 100%

We are trying to get back up to 95% coverage overall to ensure the reliability of our code. @meetulr

A test is failing because of incomplete code coverage in components outside the scope of this issue.
The coverage of src/screens/OrgPost/OrgPost.test.tsx (which is the file related to the assigned issue) is now 100%, after i made the necessary changes. I didn't change any other component or it's test file.
I've had this problem with another pull request too #1150. That pr has been merged.

@aashimawadhwa
Copy link
Member

aashimawadhwa commented Dec 9, 2023

The test are failling due to the code in this file itself, you can check the report here @meetulr

@meetulr
Copy link
Contributor Author

meetulr commented Dec 9, 2023

The test are failling due to the code in this file itself, you can check the report here @meetulr

Yes, that's what i meant. The file in the linked report is src/components/OrgPostCard/OrgPostCard.tsx, and the file associated with this issue is src/screens/OrgPost/OrgPost.tsx #1136. The test is failing because of incomplete coverage in other component files. Those components have their separate issues open which are assigned to other contributors.
Same case with my last pr #1150, which was merged despite that one test failing.
What should I do?

@palisadoes
Copy link
Contributor

The test are failling due to the code in this file itself, you can check the report here @meetulr

Yes, that's what i meant. The file in the linked report is src/components/OrgPostCard/OrgPostCard.tsx, and the file associated with this issue is src/screens/OrgPost/OrgPost.tsx #1136. The test is failing because of incomplete coverage in other component files. Those components have their separate issues open which are assigned to other contributors. Same case with my last pr #1150, which was merged despite that one test failing. What should I do?

Comment on this issue for that file so that we can assign it to you. Fix both issues with this PR.

@palisadoes
Copy link
Contributor

palisadoes commented Dec 9, 2023

According to the code coverage report this PR will get us over 95% coverage which will stop the errors in future.

image

This PR was supposed to get us over 95% which is why it was merged with the error failure. 95% coverage is our goal.

Why do you think the coverage isn't crossing the threshold?

@meetulr
Copy link
Contributor Author

meetulr commented Dec 9, 2023

The test are failling due to the code in this file itself, you can check the report here @meetulr

Yes, that's what i meant. The file in the linked report is src/components/OrgPostCard/OrgPostCard.tsx, and the file associated with this issue is src/screens/OrgPost/OrgPost.tsx #1136. The test is failing because of incomplete coverage in other component files. Those components have their separate issues open which are assigned to other contributors. Same case with my last pr #1150, which was merged despite that one test failing. What should I do?

Comment on this issue for that file so that we can assign it to you. Fix both issues with this PR.

I have commented on that issue, i'll try to fix that and see if the tests are passing then.

@palisadoes
Copy link
Contributor

I spoke too soon. I wasn't paying sufficient attention.

  1. Yes, the patch is may have 100% coverage but the overall code base has 94.7% coverage.
  2. The behaviour of CodeCov seems to have changed. The GitHub pull request CodeCov report passes with tick marks, but fails in the testing workflow.
  3. It also seems that the reporting is incorrect in other ways, because this is not the first time I've seen that the PR would improve the code coverage by an amount to get us over our 95% target, with the coverage not exceeding 95% afterwards.

In the past CodeCov has been similarly temperamental, so we have been merging test PRs for the sake of speed expecting the overall coverage to be under 95% We will be more stringent after we reach this goal.

@palisadoes
Copy link
Contributor

  1. Please post the code coverage for the file you are testing in the PR to prove you have reached 100%.
  2. Based on the online report it looks like it is only 95.08%

@meetulr
Copy link
Contributor Author

meetulr commented Dec 9, 2023

  1. Please post the code coverage for the file you are testing in the PR to prove you have reached 100%.
  2. Based on the online report it looks like it is only 95.08%
  1. Sure, if we look at the details of the test that has failed here it shows us exactly what lines were missing coverage and in what components, at the time I committed.
    As we can see, it shows no missing lines for src/screens/OrgPost/OrgPost.tsx.

  2. As for the 95.08% coverage, I think it's covering multiple files between the two commits. The change of +1.94% is because of the file I changed.

@PalisadoesFoundation PalisadoesFoundation deleted a comment from codecov bot Dec 9, 2023
Copy link

codecov bot commented Dec 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad70522) 94.77% compared to head (e2be9a8) 95.46%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1165      +/-   ##
===========================================
+ Coverage    94.77%   95.46%   +0.69%     
===========================================
  Files          138      138              
  Lines         3327     3328       +1     
  Branches       923      923              
===========================================
+ Hits          3153     3177      +24     
+ Misses         167      144      -23     
  Partials         7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@palisadoes
Copy link
Contributor

I've asked some others to review this and merge if acceptable.

@meetulr
Copy link
Contributor Author

meetulr commented Dec 10, 2023

Ok... now it's passing all the tests, the coverage is 100% for both the files (issues #1136 & #1029).

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

LGTM

@meetulr meetulr requested a review from noman2002 December 10, 2023 15:32
@meetulr
Copy link
Contributor Author

meetulr commented Dec 10, 2023

Oops!!, I accidentally clicked the refresh button which sent out another review request to you @noman2002. Please ignore it. My apologies for the confusion.

@palisadoes palisadoes merged commit 73df92c into PalisadoesFoundation:develop Dec 10, 2023
7 checks passed
@meetulr meetulr deleted the issue1136 branch December 10, 2023 17:17
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.

5 participants