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

feat!: Introduce interface for Collection to make it easier to test #31

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

tpoeppke
Copy link
Contributor

Currently it is difficult to unit test code that uses colt's Collection. It is not possible to mock a Collection as it is just a struct and it is not possible to override the underlying Mongo collection as the collection attribute is not exported.

Introducing an interface would make it a breeze to mock a Collection and therefore benefit the testability of consumers. However, currently consumers use pointers to a Collection, which is no longer possible with this change, therefore making it a breaking change.

Copy link
Owner

@jensteichert jensteichert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jensteichert jensteichert merged commit b368a4e into jensteichert:main Nov 27, 2024
3 checks passed
jakoblorz added a commit to jakoblorz/colt that referenced this pull request Nov 27, 2024
Following jensteichert#31, `Collection` is an interface now, which means a pointer to it does not make sense anymore.
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.

2 participants