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

Added mocked implementation for use in unit tests #1

Merged
merged 6 commits into from Apr 2, 2016

Conversation

mr-andreas
Copy link
Contributor

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:

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.

@mr-andreas
Copy link
Contributor Author

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?

@dukex dukex merged commit f19468a into dukex:master Apr 2, 2016
@dukex
Copy link
Owner

dukex commented Apr 2, 2016

Good job @yoshiyaka, sorry the delay

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

Successfully merging this pull request may close these issues.

None yet

2 participants