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

Closes #23: Add tests to increase coverage of 3.17 #27

Conversation

jeawhanlee
Copy link
Contributor

Description

Fixes #23
Add tests for the LRC beacon to increase coverage.

Type of change

Detailed scenario

N/A

Technical description

Documentation

Add unit tests for LRC beacon

New dependencies

N/A

Risks

N/A

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

Copy link

codacy-production bot commented Sep 2, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+9.52% (target: -1.00%) 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (6463cee) 578 294 50.87%
Head commit (8f50b8f) 578 (+0) 349 (+55) 60.38% (+9.52%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#27) 2 2 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

@jeawhanlee jeawhanlee self-assigned this Sep 2, 2024
@jeawhanlee jeawhanlee linked an issue Sep 2, 2024 that may be closed by this pull request
@jeawhanlee jeawhanlee requested a review from a team September 2, 2024 18:27
@jeawhanlee jeawhanlee added the Test label Sep 2, 2024
@MathieuLamiot
Copy link
Contributor

Thanks for the first tests @jeawhanlee 🙏
Would it make sense to also test some of the private methods? Not all of them are relevant for testing, but some contain core logic that could be good to capture in tests?

See the coverage report for more details: https://app.codacy.com/gh/wp-media/rocket-scripts/coverage/files/123936609510

@MathieuLamiot
Copy link
Contributor

@wp-media/engineering-plugin-team Since @jeawhanlee is off today, I am bringing this back to ToDo so that someone can pick it up and consider the above comment: should we cover some of the private methods too? And if yes, add some coverage to the relevant methods.

@wordpressfan
Copy link
Collaborator

I believe we can add small direct tests for those mentioned methods like _getElementDistance and others to increase the coverage here, and this is quick to tackle.

@wordpressfan
Copy link
Collaborator

That PR is taking more than expected with me because the current PR tests depending on mocking the methods using prototypes so no way to test those methods that way because if we mocked a method in one test, we can't remove this mock in the next test to validate the base method code.
That's why I'm moving from that to use Sinon Stubs.

@MathieuLamiot MathieuLamiot merged commit 13a78bf into feature/lrc-script Sep 11, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests to increase coverage of 3.17
3 participants