Skip to content

Draft: Add Vitest setup and unit test for pages

This merge request introduces Vitest-based unit testing for pages in the frontend. It also standardizes the Vitest configuration to ensure consistent test execution across local and CI environments.

Changes Included

Configured Vitest with jsdom environment and global setup

Added path alias resolution (@ → src) compatible with Vite and Vitest

Created comprehensive unit tests for admin pages:

ManageDoctorsPage

AssignRolesPage

ManageMedicalCampsPage

ManageMedicinesPage

Covered rendering, loading states, empty states, API success/failure scenarios, and user interactions

Added testing guidelines to document test structure and conventions

Benefits

Improves frontend reliability by validating critical admin workflows

Ensures consistent testing behavior in local development and CI

Provides a scalable pattern for adding future page-level unit tests

Testing

All tests executed locally using Vitest

Tests pass successfully without impacting existing functionality

Merge request reports

Loading