You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An interesting implication of this is that all the New methods would need to be used in the tests.
At the moment I have a pattern where lower-level AWS service clients are instantiated within a New call from the session which is passed in. The unit tests then, in order to inject mocks, don't use the New call, instead creating an internal struct instance.
Using a _test package would make this impossible, requiring AWS instances to be injected.
It would probably be necessary to move mocks to a separate mocks directory/package. Which might be quite nice (easy to .gitignore and clean).
The impulse here would be to move mocks to a the test package too. But this doesn't work:
found packages email (email.go) and email_test (mock_ses.go) in /Users/sambriggs/Code/go/detectordag/shared/email
Note that it doesn't complain that email_test.go has the package email_test, just that mock_ses.go does. That's because it seems there is some check on the filename.
Apparently it is possible to put tests both alongside the source they test and in a different package (as long as it is suffixed 'test').
This is good because it prevents one from testin internals
The text was updated successfully, but these errors were encountered: