WordPress-iOS
WordPress-iOS copied to clipboard
Assert tests with localized values
Hi @momo-ozawa and @hassaanelgarem ππΌ , I'm assigning y'all as reviewers based on GitHub recommendations.
Some of the unit test cases failed locally because the assertions expected the code to use ,
as the thousands separator and .
as the decimal separator. However, in my locale en_ID
, it is the other way around (e.g. 10.000
, 1,25M
).
This PR addresses the issue by using the abbreviatedString(forHeroNumber:)
for the expected value so it adjusts properly in different locales.
Alternatively, we can also force all local test runs to run in the UTC timezone and use en_US
locale, but I'm not sure if this is the best way. π€ cc-ing @mokagio in case you have thoughts on this.
To test
- Go to WordPressUnitTests.xctestplan > Configuration.
- In the Localization > Application Region field, select
Indonesia
. - π Run
DashboardStatsViewModelTests.testReturnedDataIsFormattedCorrectly()
andBlazeCampaignViewModelTests.testViewModel()
and verify that they are passing. - π Re-run the tests in your local region, and ensure that they are also passing.
Regression Notes
-
Potential unintended areas of impact Should be none.
-
What I did to test those areas of impact (or what existing automated tests I relied on) Ran the tests in both local and US locale.
-
What automated tests I added (or what prevented me from doing so) N/A.
PR submission checklist:
- [x] I have completed the Regression Notes.
- [x] I have considered adding unit tests for my changes.
- [x] I have considered adding accessibility improvements for my changes.
- [x] I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txt
if necessary.
UI Changes testing checklist:
Not applicable.
- [ ] Portrait and landscape orientations.
- [ ] Light and dark modes.
- [ ] Fonts: Larger, smaller and bold text.
- [ ] High contrast.
- [ ] VoiceOver.
- [ ] Languages with large words or with letters/accents not frequently used in English.
- [ ] Right-to-left languages. (Even if translation isnβt complete, formatting should still respect the right-to-left layout)
- [ ] iPhone and iPad.
- [ ] Multi-tasking: Split view and Slide over. (iPad)
π² You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr21982-e0240de | |
Version | 23.6 | |
Bundle ID | org.wordpress.alpha | |
Commit | e0240de4552b48e21c91fcf512f28723b102ff9f | |
App Center Build | WPiOS - One-Offs #7720 |
π² You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App Name | ![]() |
|
Configuration | Release-Alpha | |
Build Number | pr21982-e0240de | |
Version | 23.6 | |
Bundle ID | com.jetpack.alpha | |
Commit | e0240de4552b48e21c91fcf512f28723b102ff9f | |
App Center Build | jetpack-installable-builds #6736 |
Thanks for addressing this!
Hey, a quick update. As per @mokagio and @hassaanelgarem 's inputs, I tried updating the WordPressUnitTests.xctestplan
configuration to use the English
language and United States
as the location but found additional new tests failing under this setting.
Unfortunately, I'll need to put this on hold this week as I need to wrap up my project work. I'll take another look at my downtime during the meetup. In the meantime, I'll clear the milestone target and set this to Draft for now.
Thank you for the update @dvdchr