Testing JavaScript and TypeScript Applications
Write reliable JavaScript with Jest, Supertest, and React Testing Library — unit tests, mocking, API tests, and coverage.
View badge details
About This Course
Course Curriculum
12 Lessons
Jest Fundamentals
Jest Fundamentals - Lab Exercises
Why test (regression/confidence/documentation), Jest setup and configuration, describe/it/expect, matchers (toBe/toEqual/toContain/toThrow/toBeNull), test organization, running tests (--watch/--verbose/--coverage)
Testing Functions and Mocking
Testing Functions and Mocking - Lab Exercises
Testing pure functions, testing async functions (resolves/rejects), jest.fn() for mock functions, jest.mock() for module mocking, jest.spyOn(), mock implementations and return values, clearing and resetting mocks
Testing Express APIs
Testing Express APIs - Lab Exercises
Supertest for HTTP testing, testing GET/POST/PUT/DELETE endpoints, testing with test database (in-memory SQLite), testing authentication (JWT headers), testing validation (bad input), testing error responses, beforeEach/afterEach setup
Testing React Components
Testing React Components - Lab Exercises
React Testing Library philosophy (test behavior not implementation), render/screen/fireEvent/waitFor, querying (getByRole/getByText/getByTestId), testing user interactions, testing async components (data fetching), testing forms, testing routing
Coverage and CI Integration
Coverage and CI Integration - Lab Exercises
Code coverage reports (--coverage), understanding coverage metrics (statements/branches/functions/lines), coverage thresholds in jest.config, what to test vs what not to test, snapshot testing (when useful/when harmful), CI pipeline integration basics
Capstone Briefing Add Tests to ByteForge
Capstone Add Tests to ByteForge - Lab Exercises
Capstone: retrofit tests onto the ByteForge Express API and React dashboard. Unit tests for utilities, API tests with supertest, React component tests with Testing Library, mock external dependencies, achieve 80%+ coverage