RevenueCat / purchases-android

Android in-app purchases and subscriptions made easy.
https://www.revenuecat.com/
MIT License
234 stars 44 forks source link

Change android integration test to cover more testable use case #1760

Closed tonidero closed 2 weeks ago

tonidero commented 2 weeks ago

Description

We had a test that verifies that a token gets recognized and entitlements given if the user is offline, then they recover, but that test wasn't working correctly, since the token we used didn't grant any entitlements (was an expired token).

After changing to a proper token, this test started failing because the token was already assigned to a different user and we were posting it with initiation source unsynced_active_purchases, which doesn't transfer active purchases, so the entitlement was never granted. In order to properly test that case, we would need a new token every time we run the tests which we currently can't have, since testing with Google Play is bad :(.

For now, I've changed the test to cover recovery after a restore, which does work as expected. Happy to provide more details as needed!

codecov[bot] commented 2 weeks ago

Codecov Report

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

Project coverage is 83.25%. Comparing base (80c4e17) to head (ebf7a27).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1760 +/- ## ======================================= Coverage 83.25% 83.25% ======================================= Files 223 223 Lines 7608 7608 Branches 1069 1069 ======================================= Hits 6334 6334 Misses 853 853 Partials 421 421 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.