I want to test my js app that uses phoenix.js sockets. I want to write tests along the lines of:
- Set up a mocked socket and channel.
- Render my app.
- Interact with the app.
- Assert that a message was sent on the channel.
- Mock a response to that message as if the server had replied.
- Assert that the UI was updated with the response.
Is there a recommended way to do this?
I’m familiar with using jest to mock functions, but I’m struggling to set it up through the layers of callbacks and classes in a way that lets me assert something was pushed or send a reply.