Question

The iOS SDK has become impossible to mock in v4

  • 29 April 2022
  • 1 reply
  • 55 views

Badge +1

The new revenue cat v4 SDK for iOS is very difficult if not impossible to mock for unit testing purposes. Some of the contributing factors that make mocking difficult are:

  1. The majority of classes like Offerings, Offering, Package, etc are marked as final so they can’t be subclassed. So something like class MockOfferings: Offerings {} cannot be done.
  2. The majority of initializers for classes like Offerings, Offering, Package are internal so they cannot be called from outside the package

These issues are blocking upgrading to v4 since it breaks all the existing unit tests without a new way to fix them. Is there any sample code available that successfully mocks the RevenueCat SDK?


1 reply

Badge +1

Have the same issue with unit tests breaking with v4. Has anyone found a solution to this?

Reply