I am using Localytics in my app which is basically just an API that can be used to send analytics data to the server.
https://docs.localytics.com/dev/ios.html#install-sdk-ios
I work in a project where we have to unit test every single file to make sure that there is atleast 90% code coverage.
Since localytics is an external library, I have a wrapper around it to use the API.
Consider the simple localytics method :
func tagScreen(screenName: String) {
Localytics.tagScreen(screenName)
}
How can I unit test this wrapper?
Is there any suggestions?
How can we write Mocks for the method above?
If you want to test the wrapper: as
Localyticshas static functions to interact with I would go with something like:Now you can inject mock function and test the wrapper