Closed willfaught closed 1 year ago
This is something I wouldn't mind either, which I opened #21 for. Ben has been reworking the code a fair bit, so I'm not sure what this will look like.
Go lets us create interfaces for code in other packages, so there may be a way to do this without requiring changes to timehop/apns. I'm not sure, as I haven't given it much thought yet.
@nathany I wrote my own interface wrapper for apns.Client, but it ought to be unnecessary, and it's so easy to do.
Definitely makes sense. In retrospect, testing against a apns.Client
struct is def a pain. Happy to merge if someone wants to open a PR
In order to test code that uses this client, I would have to mock net.Conn, if I understand correctly. This is onerous; mocking the client's API is much easier. Exporting a mockable client interface, and an implementation of it, helps with this.
Something along these lines...
so we can test code like this:
like this: