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

Interface for mocking in tests #6

Open
kevinmichaelchen opened this issue Sep 9, 2019 · 1 comment
Open

Interface for mocking in tests #6

kevinmichaelchen opened this issue Sep 9, 2019 · 1 comment
Assignees

Comments

@kevinmichaelchen
Copy link

It'd be nice if there were an interface for the Chargebee client, which provided all the various methods for interacting with the Chargebee SDK.

The Kubernetes Go SDK provides an interface called kubernetes.Interface, an actual implementation called kubernetes.Clientset, and a implementation for tests called fake.Clientset.

@sanan-fataliyev
Copy link

even though it would be nice for us - consumers, but it seems it's a popular antipattern in golang.

https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Go interfaces generally belong in the package that uses values of the interface type, not the package that implements those values.

Do not define interfaces on the implementor side of an API "for mocking"; instead, design the API so that it can be tested using the public API of the real implementation.

cb-navaneedhan added a commit that referenced this issue Sep 29, 2020
Fixing: Multithreading issue due to global variables: CUSTISSUE-483
@cb-rakesh cb-rakesh self-assigned this Aug 19, 2021
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