Adding Tests to Channels
We started this chapter by testing our information system, including unit-testing our supporting code for the Wolfram backend. Now it’s time to test our channels code. Remember that underneath, channels are also OTP servers. Phoenix includes the Phoenix.ChannelTest module, which will simplify your testing experience. With it, you can make several types of common assertions. For example, you can assert that your application pushes messages to a client, replies to a message, or sends broadcasts. Let’s look at some code.
The rumbrella/apps/rumbl/test/support/channel_case.ex is a file that was generated by Mix when we generated the rumbl application. You’ve already seen a couple of similar test cases with model_case and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access