woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
44 stars 21 forks source link

[API Pull] Ensure empty GLA attributes are returned as an object instead of an empty array in the responses. #2455

Closed jorgemd24 closed 1 month ago

jorgemd24 commented 1 month ago

Changes proposed in this Pull Request:

Part of #2146

This PR ensures that empty GLA attributes are returned as an empty object instead of an empty array, maintaining consistency in the responses.

Screenshots:

Detailed test instructions:

  1. Remove any attribute mapping set.
  2. Make a request to GET wp-json/wc/v3/products/PRODUCT_ID?gla_syncable=1
  3. Check that gla_attributes is returned as an empty object instead of an empty array.

Additional details:

Changelog entry

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.7%. Comparing base (d47c264) to head (0642055). Report is 1 commits behind head on feature/google-api-project.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455/graphs/tree.svg?width=650&height=150&src=pr&token=UROWUPF1LX&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) ```diff @@ Coverage Diff @@ ## feature/google-api-project #2455 +/- ## ============================================================== + Coverage 64.4% 64.7% +0.3% Complexity 4551 4551 ============================================================== Files 795 473 -322 Lines 22796 17753 -5043 Branches 1219 0 -1219 ============================================================== - Hits 14688 11484 -3204 + Misses 7941 6269 -1672 + Partials 167 0 -167 ``` | [Flag](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | Coverage Δ | | |---|---|---| | [js-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `?` | | | [php-unit-tests](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | `64.7% <100.0%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce) | Coverage Δ | | |---|---|---| | [src/Integration/WPCOMProxy.php](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455?src=pr&el=tree&filepath=src%2FIntegration%2FWPCOMProxy.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce#diff-c3JjL0ludGVncmF0aW9uL1dQQ09NUHJveHkucGhw) | `70.2% <100.0%> (ø)` | | ... and [322 files with indirect coverage changes](https://app.codecov.io/gh/woocommerce/google-listings-and-ads/pull/2455/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=woocommerce)