-
Notifications
You must be signed in to change notification settings - Fork 50
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
Paywalls
: add test coverage for locales with different region
#1600
Conversation
Test coverage to ensure that Android isn't affected by RevenueCat/purchases-ios#3633. I've also extracted `getDefaultLocales` and `localizedConfiguration(List<Locale>)` so we can test those.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1600 +/- ##
==========================================
+ Coverage 83.71% 83.76% +0.04%
==========================================
Files 218 218
Lines 7260 7263 +3
Branches 1011 1011
==========================================
+ Hits 6078 6084 +6
+ Misses 788 787 -1
+ Partials 394 392 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question but looks good!
fun `getDefaultLocales returns the correct list`() { | ||
assertThat( | ||
getDefaultLocales().map { it.toString() } | ||
).isEqualTo(listOf("en_US")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm if I'm not wrong, this test will only pass on devices where the default locale is en_US
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. Do you have any suggestions that wouldn't lead to false positives (like overriding the locale ourselves).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm difficult to do without mocking, which would lose the purpose of the test... Honestly the value of the test is limited since the unit tests don't run in an android image but on the JVM virtual machine (in some cases, there are some differences)
Having said that, I think we can either keep it as is, even if it might fail in some devices, or just return early if the locale is not Locale.US
so we don't test in those devices. Feels like the first option might be safer but we should add a comment so when it fails, we are aware of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah ideally we only run this on CI, where I think it's safe to assume it's that locale. But we don't have a way to detect that, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not right now no... We could potentially pass a parameter in CI for that through gradle. That could be an option as well yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add a comment for now then.
Test coverage to ensure that Android isn't affected by RevenueCat/purchases-ios#3633.
I've also extracted
getDefaultLocales
andlocalizedConfiguration(List<Locale>)
so we can test those.