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

[API PULL] Fix tests for Notifying delete products #2626

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

puntope
Copy link
Contributor

@puntope puntope commented Sep 27, 2024

Changes proposed in this Pull Request:

There is a test failing in regards

Automattic\WooCommerce\GoogleListingsAndAds\Tests\Unit\Product\SyncerHooksTest::test_delete_created_product_calls_notify_directly
Expectation failed for method name is "notify" when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.

This seems to happen because the metadata is empty after the code calls the delete hook. To solve it. I moved the notifications to the pre-delete.

Screenshots:

Detailed test instructions:

  1. Tests are passing
  2. Create a simple product. It will schedule a create notification. See it works as expected and shows in the logs after the action is completed.
  3. Trash the simple product. See directly the delete notification in the logs.

Additional details:

Changelog entry

Tweak - Logic for Delete notifications.

@github-actions github-actions bot added type: bug The issue is a confirmed bug. changelog: fix Took care of something that wasn't working. labels Sep 27, 2024
@puntope puntope requested a review from a team September 27, 2024 09:03
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.3%. Comparing base (1c6a902) to head (5b6924f).
Report is 18 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             develop   #2626   +/-   ##
=========================================
  Coverage       65.3%   65.3%           
  Complexity      4596    4596           
=========================================
  Files            474     474           
  Lines          17893   17896    +3     
=========================================
+ Hits           11685   11688    +3     
  Misses          6208    6208           
Flag Coverage Δ
php-unit-tests 65.3% <100.0%> (+<0.1%) ⬆️

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

Files with missing lines Coverage Δ
src/Product/SyncerHooks.php 90.0% <100.0%> (ø)

... and 1 file with indirect coverage changes

Copy link
Contributor

@jorgemd24 jorgemd24 left a comment

Choose a reason for hiding this comment

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

Thanks @puntope for fixing this! I tested it locally, and everything is working well.

@puntope puntope merged commit 88146e9 into develop Oct 2, 2024
14 checks passed
@puntope puntope deleted the fix/api-pulldelete-products branch October 2, 2024 13:21
@tomalec tomalec mentioned this pull request Oct 2, 2024
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants