Hi! My name is Artem, and in this course I will teach you how to mock WebSocket APIs with Mock Service Worker. You and I are going to build a chat application mock-first, and you will learn how to intercept WebSocket connections, handle client and server events, and also test the code that relies on WebSocket in Vitest and Playwright. Let's go!
[00:00] Hi, my name is Artem and in this course I will teach you how to mock WebSocket APIs with mock service worker and what's the best way to learn? That's right to build so you and I gonna build a chat application together where you will learn how to intercept WebSocket connections handle client and server events and also toggle between the full control of the WebSocket communication and augmented control where you will be modifying the actual server events coming in. As usual, mocking with MSW is standard based and works everywhere, both in the browser and in Node.js. We're also going to take a look how you would test your WebSocket applications on an integration level with VTest and on end-to-end level with PlayWrite, both utilizing the same MSW setup, event handlers, and sometimes overrides when we need different behaviors and tests. Buckle up because you've never developed and tested your WebSocket apps this way.
[00:53] Let's go!