Skip to content

React project with comprehensive testing setup using React Testing Library and MSW and Cypress for mocked API requests. Ensures reliable unit and integration and E2E tests with a focus on user-centric behavior and maintainable codebase.

Notifications You must be signed in to change notification settings

NinjaStackX/react-tester

Repository files navigation

🚀 Release v1.0.0-msw-integration

📝 Overview

This release represents a major milestone in the development lifecycle, focusing on establishing a Robust Testing Infrastructure and a Scalable State Management system. We have transitioned from basic unit testing to professional-grade integration testing.


✨ Key Features & Enhancements

🛠 Automated Network Interception (MSW)

  • Industry Standard: Replaced hardcoded axios mocks with MSW (Mock Service Worker).
  • Decoupled Logic: Network requests are now intercepted at the network level, allowing tests to run against actual axios calls without external dependencies.
  • Consistency: Centralized all API mock handlers in src/mocks/handlers.js for better maintainability.

🧪 Advanced Integration Testing

  • User Journeys: Implemented integration tests for the Dashboard and Login flows, ensuring data flows correctly between the API, Context, and UI.
  • Dynamic Testing Utility: Refactored the renderi custom render function to inject UserProvider and MemoryRouter dynamically, supporting both "Guest" and "Authenticated" test scenarios.

🔑 Authentication & Global Context

  • UserContext API: Robust global state for managing authentication sessions (login, logout, user status).
  • Protected UI: Dynamic rendering of navigation links based on user authentication state.

🎨 UI & UX Improvements

  • Tailwind Integration: Completely refactored the Dashboard and Login components with a responsive, professional design.
  • Skeleton Loading: Added visual feedback for asynchronous data fetching states.

🛠 Technical Stack

  • Frontend: React 18+ & Tailwind CSS
  • Routing: React Router 6 (Basename-ready for GitHub Pages)
  • Testing: Vitest, React Testing Library, MSW
  • Mocking: MSW (REST API handlers)

🚦 How to run tests

# To run unit and integration tests
pnpm test

About

React project with comprehensive testing setup using React Testing Library and MSW and Cypress for mocked API requests. Ensures reliable unit and integration and E2E tests with a focus on user-centric behavior and maintainable codebase.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published