We've completed the work on building the sagas, but we have just a couple of adjustments to make in the rest of the app in order to integrate the new feature. First, our MenuButtons are functionally complete, but we need to update the tests to properly exercise the middleware, ensuring we stub out the web socket library. Second, we need to fire off a TRY_START_WATCHING action as soon as the app starts:
- In test/MenuButtons.test.js, add in a server socket stub at the top of the describe block named sharing button:
let socketSpyFactory;
let socketSpy;
beforeEach(() => {
socketSpyFactory = jest.spyOn(window, 'WebSocket');
socketSpyFactory.mockImplementation(() => {
socketSpy = {
close: () => {},
send: () => {}
};
return socketSpy;
});
});
afterEach(() => {
socketSpyFactory.mockReset();
});
- Import act in the same way...