Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

The test for 0 bytes filesize claimed the empty string was returned "because isVisible will hide it", but the actual reason is the truthy check in getValue:

getValue: ( { item }: { item: MediaItem } ) =>
    item?.media_details?.filesize
        ? formatFileSize( item?.media_details?.filesize )
        : '',

Since 0 is falsy in JavaScript, getValue returns '' before formatFileSize is ever called. The formatFileSize function would actually return "0 B" if it received 0 (line 47-49), but it never reaches that code path.

Changes

  • Updated test description to "returns empty string for 0 bytes due to truthy check"
  • Clarified comment to explain the truthy check behavior
  • Added note that formatFileSize would return "0 B" for 0, but is never called

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • translate.wordpress.org
    • Triggering command: /usr/local/bin/node node i18n-cache/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] WIP address feedback on tests for media fields Fix misleading test description for filesize field 0 bytes behavior Dec 16, 2025
Copilot AI requested a review from ramonjd December 16, 2025 02:01
@ramonjd ramonjd marked this pull request as ready for review December 16, 2025 02:31
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link

github-actions bot commented Dec 16, 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: @Copilot.

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: Copilot.

Co-authored-by: ramonjd <[email protected]>

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

@ramonjd ramonjd merged commit ed85e43 into add/media-fields-tests Dec 16, 2025
28 checks passed
@ramonjd ramonjd deleted the copilot/sub-pr-74015-8411085f-670a-4eb5-ad78-f9b43ccfe596 branch December 16, 2025 02:32
@github-actions
Copy link

Flaky tests detected in be44b67.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20254480079
📝 Reported issues:

@andrewserong
Copy link
Contributor

Wow, looks like Copilot is trying to improve its merged PRs stats 😆

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.

3 participants