wagslane/go-rabbitmq

interface for connection struct

aaqaishtyaq opened this issue · 1 comments

Currently, it is very difficult to write unit tests for the codebase that uses this library. There is no exported interface for the connection struct and it is difficult to mock this.

Please provide guidelines for writing unit tests.

My first recommendation would be to make sure you're writing unit tests. You might be trying to write integration tests, or unit test at the wrong level (too high) https://blog.boot.dev/clean-code/writing-good-unit-tests-dont-mock-database-connections/

If you're sure you're testing at the right level though, you should be able to create your own interface no?