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

[question]: How to mock OneSignal #879

Closed
1 task done
MarcelGalster opened this issue Apr 29, 2024 · 3 comments
Closed
1 task done

[question]: How to mock OneSignal #879

MarcelGalster opened this issue Apr 29, 2024 · 3 comments

Comments

@MarcelGalster
Copy link

MarcelGalster commented Apr 29, 2024

How can we help?

Hi, I want to write tests for my OneSingal integration and need to mock OneSignal to do this.
How can I do this as OneSignal only has static members?

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nan-li
Copy link
Contributor

nan-li commented May 8, 2024

Hi @MarcelGalster, it is not easy to mock OneSignal for tests as it does only have static members.

What types of behaviors are you trying to test?

@jennantilla
Copy link
Contributor

Closing due to no response.

@MarcelGalster
Copy link
Author

Hello, sorry for my late reply.

I have a service in which I want to inject OneSignal. In my tests I want to inject a mocked OneSignal service. But dependency injection is not possible because the members are all static and there is no interface that OneSignal implements.

So what are your recommendations to do it as you implemented OneSignal in this way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants