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

Improve Test Coverage for Auto Sizes Plugin #1879

Open
wants to merge 8 commits into
base: trunk
Choose a base branch
from

Conversation

sarthak-19
Copy link
Contributor

@sarthak-19 sarthak-19 commented Feb 18, 2025

Summary

This is part of #1789:

  • Ignore Coverage for Non-Critical Code Blocks
  • Add Missing @covers Annotations
  • Add Missing Tests
Before : 79.00% ⚠️ After: 95.00% ✅
image  image

cc : @westonruter

@sarthak-19 sarthak-19 changed the title Improve Test Coverage for Web Worker Offloading Plugin Improve Test Coverage for Auto Sizes Plugin Feb 18, 2025
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.07%. Comparing base (2c3e1ca) to head (a248246).
Report is 2 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1879      +/-   ##
==========================================
+ Coverage   66.70%   67.07%   +0.36%     
==========================================
  Files          88       86       -2     
  Lines        7029     7009      -20     
==========================================
+ Hits         4689     4701      +12     
+ Misses       2340     2308      -32     
Flag Coverage Δ
multisite 67.07% <ø> (+0.36%) ⬆️
single 37.45% <ø> (+0.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@sarthak-19 sarthak-19 marked this pull request as ready for review February 18, 2025 19:49
Copy link

github-actions bot commented Feb 18, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @[email protected].

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: [email protected].

Co-authored-by: sarthak-19 <[email protected]>
Co-authored-by: mukeshpanchal27 <[email protected]>
Co-authored-by: pravinparmar2404 <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@@ -49,7 +49,7 @@ function auto_sizes_update_image_attributes( $attr ): array {
*/
function auto_sizes_update_content_img_tag( $html ): string {
if ( ! is_string( $html ) ) {
$html = '';
$html = '';// @codeCoverageIgnore

Choose a reason for hiding this comment

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

Suggested change
$html = '';// @codeCoverageIgnore
$html = ''; // @codeCoverageIgnore

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @pravinparmar2404 for contribution.

Copy link
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

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

Nit-pick

@@ -16,7 +16,7 @@
*/
function auto_sizes_prime_attachment_caches( $content ): string {
if ( ! is_string( $content ) ) {
return '';
return '';// @codeCoverageIgnore
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
return '';// @codeCoverageIgnore
return ''; // @codeCoverageIgnore

@@ -26,7 +26,7 @@ function auto_sizes_prime_attachment_caches( $content ): string {
$class = $processor->get_attribute( 'class' );

if ( ! is_string( $class ) ) {
continue;
continue;// @codeCoverageIgnore
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
continue;// @codeCoverageIgnore
continue; // @codeCoverageIgnore

@@ -63,7 +63,7 @@ function auto_sizes_prime_attachment_caches( $content ): string {
*/
function auto_sizes_filter_image_tag( $content, array $parsed_block, WP_Block $block ): string {
if ( ! is_string( $content ) ) {
return '';
return '';// @codeCoverageIgnore
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
return '';// @codeCoverageIgnore
return ''; // @codeCoverageIgnore

@westonruter westonruter added [Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) [Type] Enhancement A suggestion for improvement of an existing feature skip changelog PRs that should not be mentioned in changelogs labels Feb 21, 2025
@westonruter westonruter added this to the auto-sizes n.e.x.t milestone Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Enhanced Responsive Images Issues for the Enhanced Responsive Images plugin (formerly Auto Sizes) skip changelog PRs that should not be mentioned in changelogs [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants