An open API service indexing awesome lists of open source software.

https://github.com/asrieldreemurrgm/jest_testing_study

Practice project to learn and implement unit and integration tests using Jest and React Redux.
https://github.com/asrieldreemurrgm/jest_testing_study

automated-tests frontend-testing html5 integration-tests jest jest-tests mock-service-worker preloaded-state react-redux react-testing test-coverage testing testing-library tests typescript unit-tests

Last synced: 10 months ago
JSON representation

Practice project to learn and implement unit and integration tests using Jest and React Redux.

Awesome Lists containing this project

README

          

Jest Testing Study



Este README também está disponível em Português.



A hands-on learning project designed to explore testing practices in React applications using Jest, Testing Library, and React Redux. This includes tests for components, user interactions, alerts, and Redux logic, while integrating tools like Mock Service Worker and code coverage reporting.


🧪 What’s Being Tested



  • React component rendering and interaction;

  • Redux store and dispatched actions using preloadedState;

  • Form behavior and UI events using fireEvent and screen;

  • Alert messages and side effects triggered by components;

  • Mock Service Worker (MSW) for API simulations;

  • Custom render utilities for provider wrapping;

  • Unit tests for utility functions and string operations;

  • Test coverage reports.


⚙️ Technologies Used



  • React

  • Redux Toolkit

  • TypeScript

  • Jest

  • React Testing Library

  • Mock Service Worker (MSW)


📂 Folder Structure




src/
├── components/ # Components with associated tests
├── store/ # Redux setup with preloaded state
├── utils/ # Utility functions and helpers
├── tests/ # Jest test files and helpers
└── App.tsx # Main application entry

📌 Commit Highlights




  • Render Tests – Created tests for header, product list, and cart items;


  • Redux Store Refactor – Refactored store to support preloadedState and reusable render logic;


  • Mock Service Worker – Integrated MSW to simulate backend API behavior during tests;


  • Coverage Script – Added script to check project coverage;


  • Alert Component Test – Added test to validate product alert logic.


📝 Notes



  • This project is for study and practice purposes only;

  • Code is written with readability and test clarity in mind;

  • Jest is used with TypeScript and configured for React DOM testing;

  • Comments are added throughout to explain testing logic.