Test-driving a WebSocket connection
We start by filling out that first function, startSharing. This function is invoked when the START_SHARING action is received. That action is triggered when the user clicks the Start sharing button:
- Open 
test/middleware/sharingSagas.test.jsand add the following imports at the top:import { storeSpy, expectRedux } from "expect-redux"; import { act } from "react-dom/test-utils"; import { configureStore } from "../../src/store"; - At the bottom of the file, add a new 
describeblock and its setup. We’ll break this into a couple of steps: first, set up the Redux store and the WebSocket spy. Becausewindow.WebSocketis a constructor function, we usemockImplementationto stub it out:describe("sharingSaga", () => { let store; let socketSpyFactory; beforeEach(() => { store = configureStore([storeSpy]); socketSpyFactory...