Skip to content
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

Make Purchases a singleton #153

Open
IchordeDionysos opened this issue Feb 22, 2021 · 5 comments
Open

Make Purchases a singleton #153

IchordeDionysos opened this issue Feb 22, 2021 · 5 comments
Labels
enhancement New feature or request triaged

Comments

@IchordeDionysos
Copy link

Purchases is currently only like a namespace for several functions and has several static functions.

As the functions are static it makes it hard to mock Purchases to write tests if data is correctly passed to RevenueCat.

Would be better to adopt something like:
https://github.com/FirebaseExtended/flutterfire/blob/master/packages/cloud_firestore/cloud_firestore/lib/src/firestore.dart

This would allow to mock and verify calls to Purchases, like:

verify(mockPurchases.setCampaign(campaign));
verifyNoMoreInteractions(mockPurchases.setCampaign);
@IchordeDionysos IchordeDionysos added the enhancement New feature or request label Feb 22, 2021
@IchordeDionysos
Copy link
Author

@vegaro might be a change worth doing with #149 to minimize breaking changes.

@taquitos
Copy link
Contributor

<itsHappening.gif> in our next major, which is soon.

@jsgalarraga
Copy link

Is there any chance this moves forward to improve testablity?
@vegaro @taquitos

@EnduringBeta
Copy link

I ran into this limitation today. Just to understand, @taquitos said this would be in the next major, which at the time (Oct 2021 - 3.4.5) would have been v4. We're now at 5.6.1.

It's fine to need to change direction or not complete a feature, but communicating that and setting expectations would be very helpful. @vegaro

@cmoiccool
Copy link

Any update on this issue ?

It is quite frustrating to not be able to simply mock Purchases to write tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

5 participants