Kulcare Docs
Feature QA checklists

Mock Data Architecture

Centralized mock data management using the @kulcare/mock-data package for consistent development and testing.

Package Structure

packages/mock-data/
├── src/
│   ├── cms/           # CMS module mock data
│   ├── auth/          # Authentication mock data  
│   ├── growth/        # Growth module mock data
│   ├── utils/         # Generic utilities
│   └── index.ts       # Main exports

Usage

Basic Import

import { mockDoctors, getDoctorsByClinic, type Doctor } from "@kulcare/mock-data"

Service Integration

// In service files
if (import.meta.env.DEV && !useRealAPI) {
  const filteredData = getDoctorsByClinic(clinicId)
  return { success: true, data: filteredData }
}

Available Utilities

CMS Data:

  • mockDoctors, getDoctorsByClinic(), getAvailableDoctors()
  • mockCategories, getCategoriesByStatus(), getCategoryById()
  • mockQueuePatients, getQueueByStatus(), getQueueByDoctor()
  • mockPatients, searchPatients(), getPatientsByGender()

Auth Data:

  • mockUsers, getUserByEmail(), validateUserCredentials()
  • mockClinics, getClinicById(), getClinicsForUser()

Growth Data:

  • mockSocialPosts, getPostsByStatus(), getPostsByPlatform()

Generic Utilities:

  • createMockService() - CRUD operations with filtering/pagination
  • createMockApiResponse() - API response simulation with delays
  • mockUtils - Environment detection and logging

Environment Control

Mock data usage is controlled by environment variables:

  • VITE_USE_REAL_API=false (default) - Uses mock data in development
  • VITE_USE_REAL_API=true - Forces real API usage

Benefits

  • Centralized: All mock data in one package
  • Type-safe: Full TypeScript support
  • Reusable: Shared across apps and tests
  • Maintainable: Easy to update and extend
  • Testable: Utilities for different test scenarios

Development Workflow

  1. Add new mock data: Create in appropriate domain folder
  2. Add utilities: Use generic createMockService() or custom functions
  3. Update services: Import and use in API service files
  4. Test: Verify with pnpm typecheck and pnpm build

On this page