mix test now passes without needing to connect to Slack.
The Slack client code is not very test-friendly :/
I changed the job of Connector slightly so that it now acts as an abstraction on top of sending/receiving data from/to Slack and does not actually handle the messages. Then I added a TestConnector module that plays the same role during tests. The TestConnector module also collects sent messages, which allows us to test (for example) that receiving a particular message results in sending a reply.
It's a little weird that the Printer module handles the messages, but effectively it was doing that before these changes - the messages were relayed from Connector to MessageProducer to Printer and then back to Connector. I think that should get cleaned up but I don't think it's in the scope of this PR.
mix test
now passes without needing to connect to Slack.The Slack client code is not very test-friendly :/
I changed the job of Connector slightly so that it now acts as an abstraction on top of sending/receiving data from/to Slack and does not actually handle the messages. Then I added a TestConnector module that plays the same role during tests. The TestConnector module also collects sent messages, which allows us to test (for example) that receiving a particular message results in sending a reply.
It's a little weird that the Printer module handles the messages, but effectively it was doing that before these changes - the messages were relayed from Connector to MessageProducer to Printer and then back to Connector. I think that should get cleaned up but I don't think it's in the scope of this PR.