Summary
In this chapter, we’ve covered how to test against the WebSocket API.
You’ve seen how to mock the WebSocket constructor function, and how to test-drive its onopen
, onclose
, and onmessage
callbacks.
You’ve also seen how to use a Promise
object to convert a callback into something that can be yielded in a generator function, and how you can use eventChannel
to take a stream of events and send them into the Redux store.
In the next chapter, we’ll look at using Cucumber tests to drive some improvements to the sharing feature.