Skip to content

Conversation

malinajirka
Copy link
Contributor

@malinajirka malinajirka commented Oct 16, 2025

#WOOMOB-1286

Description

Adds unit tests for WooPosVariationMapper.

Note: I decided to initialize an actual Gson instead of mocking it. Since it's a well-tested library, it feels better to have an instance of the class in the tests.

Testing information

Green CI

The tests that have been performed

Green CI

Images/gif

N/A

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@malinajirka malinajirka added this to the 23.6 milestone Oct 16, 2025
@malinajirka malinajirka requested a review from Copilot October 16, 2025 11:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces comprehensive unit tests for the WooPosVariationMapper class, which is responsible for mapping product variation data between different data models in the WooCommerce POS system.

Key Changes:

  • Added 41 test cases covering all mapping functions in WooPosVariationMapper
  • Tests cover mapping from ProductVariation, WCProductVariationModel, and WooPosVariationEntity to WooPosVariation
  • Tests validate name formatting functions for POS display (both getName and getNameForPOS)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitcbb5f55
Direct Downloadwoocommerce-wear-prototype-build-pr14770-cbb5f55.apk

@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitcbb5f55
Direct Downloadwoocommerce-prototype-build-pr14770-cbb5f55.apk

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.34%. Comparing base (d2f63c9) to head (cbb5f55).

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14770      +/-   ##
============================================
+ Coverage     38.28%   38.34%   +0.06%     
- Complexity    10011    10041      +30     
============================================
  Files          2118     2118              
  Lines        118502   118502              
  Branches      15827    15827              
============================================
+ Hits          45364    45443      +79     
+ Misses        68924    68836      -88     
- Partials       4214     4223       +9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samiuelson samiuelson self-assigned this Oct 17, 2025
Copy link
Contributor

@samiuelson samiuelson left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@samiuelson samiuelson merged commit 3798c60 into trunk Oct 17, 2025
20 of 21 checks passed
@samiuelson samiuelson deleted the issue/woomob-1286-woo-poslocal-catalog-add-unit-tests-for branch October 17, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants