I've changed the Mixpanel struct to be an interface and added a mock implementation in addition to the current real implementation. This makes it easy to test code which uses mixpanel:
var client mixpanel.Mixpanel = mixpanel.NewMock()
people = client.Identify("1")
people.Update("$set", map[string]interface{}{
"custom_field": "cool!",
})
// client.People now holds the tracked data
Also, functions now only return a single error and not an HTTP response, making error handling easier.
Ok, so this PR has gotten quite huge, the library has changed in many ways. Do you want to merge this, or would you rather see that we just keep our own fork?
Hi!
I've changed the
Mixpanel
struct to be an interface and added a mock implementation in addition to the current real implementation. This makes it easy to test code which uses mixpanel:Also, functions now only return a single error and not an HTTP response, making error handling easier.