Mock Service Worker - Overview

Mock Service Worker (MSW) is a library that helps you mock HTTP requests in your tests. We can use it to define request handlers to respond different mock data mainly for testing. Let’s see how to use MSW in browser environment. Installation Install msw package bun install msw Setup Create a index.js which will be used to setup MSW and ship to browser. import { HttpResponse, http } from "msw"; import { setupWorker } from "msw/browser"; // handlers const userHandler = () => { return HttpResponse....

TypeScript Overview

TypeScript has gained popularity for it’s ability to add type system to Javascript. Typescript code will be transpiled to Javascript code which can be run in any browser. Few things I like about TypeScript are Static Typing: TypeScript provides static typing which helps in catching errors at compile time. Strong Tooling: TypeScript has strong tooling support with features like code completion, refactoring, etc. Community: TypeScript has a large and active community that provides support, libraries, and tools....