Skip to content

This PR removes hardcoded mock data from the vaccination compliance#639

Merged
llinsss merged 31 commits into
DogStark:mainfrom
Jambox11:main
Jun 26, 2026
Merged

This PR removes hardcoded mock data from the vaccination compliance#639
llinsss merged 31 commits into
DogStark:mainfrom
Jambox11:main

Conversation

@Jambox11

Copy link
Copy Markdown
Contributor

Summary
This PR removes hardcoded mock data from the vaccination compliance analytics API route and three user-facing pages (appointments, clinic directory, clinic detail). Each surface now fetches live data from the NestJS backend via typed API clients, with loading, empty/error (and not-found for clinic detail) UI states and Jest component tests.

Changes
#548 — Replace mock vaccination compliance data in analytics route
Replaced static compliance object in compliance.ts with a server-side fetch to {API_BASE_URL}/analytics/vaccinations/compliance
Forwards Authorization from the incoming request and query params (startDate, endDate, petId, etc.)
Returns { error: string } on backend failure (consistent with sibling routes)
Added route unit tests with mocked fetch
#549 — Replace MOCK_UPCOMING with real appointments fetch
Added src/lib/api/appointmentsAPI.ts with getUpcomingAppointments() → GET /appointments/upcoming
Maps backend appointment entities to frontend Appointment type with pet/vet display names
appointments.tsx fetches on load with loading, empty, error+retry states
Removed MOCK_UPCOMING entirely
Added component tests for all four UI states
#550 — Replace MOCK_CLINICS with real backend fetch
Added src/lib/api/clinicsAPI.ts with getClinics() → GET /vet-clinics
Maps backend VetClinic entities to frontend Clinic type (locations, hours, services)
clinics/index.tsx fetches on load with loading, empty, error+retry states
Removed MOCK_CLINICS entirely
Added component tests for all four UI states
#551 — Replace MOCK_CLINIC_DETAILS with real backend fetch
Extended clinicsAPI with getClinicById(id) → GET /vet-clinics/:id
clinics/[id].tsx reads id from useRouter, fetches on load
Added loading, not-found (404), and error+retry states
Removed MOCK_CLINIC_DETAILS entirely
Added component tests for all four UI states
Testing
npm test
#548: compliance.test.ts — proxies auth header, returns backend JSON, typed error on failure
#549: appointments.test.tsx — loading / empty / error+retry / list with data
#550: clinics/index.test.tsx — loading / empty / error+retry / ClinicCard list
#551: clinics/[id].test.tsx — loading / 404 not-found / error+retry / detail render
Manual verification: Run backend + npm run dev, visit /appointments, /clinics, /clinics/{id} with a valid auth token in localStorage.

Notes
API base URL uses getApiBaseUrl() (/api/v1 prefix) matching userAPI / qrcodeAPI
Backend endpoints: /analytics/vaccinations/compliance, /appointments/upcoming, /vet-clinics, /vet-clinics/:id
Clinic type from src/types/clinic.ts; backend VetClinic is mapped to that shape (no separate ClinicDetail type exists)
Jest + Testing Library added as devDependencies; jest.config.js scoped to src/ to avoid conflicting ts-node test files
Closes #548, Closes #549, Closes #550, Closes #551

scriptnovaa and others added 28 commits June 24, 2026 14:35
…eService in pet tests

- Replace useWallet.ts with the authoritative upstream version (uses walletService,
  walletService.fetchAccountData, walletService.createWallet etc.) to resolve build
  conflict — the upstream already had this hook implemented
- Update useWallet.test.ts to test the upstream hook's actual API (createWallet,
  importWallet, deleteWallet, sendPayment, fundTestnet, balance fetch error handling)
- Add CacheService mock to pets.service.spec.ts — PetsService gained a CacheService
  dependency (index [3]) in a recent upstream PR but the test module was not updated,
  causing Nest DI resolution failures on every PR CI run

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Frontend:
- Rename src/i18n/index.ts → index.tsx to fix Turbopack JSX parse error

Backend tests:
- create-block.dto.ts: rename blockedId → blockedUserId to match BlockService and specs
- create-report.dto.ts: revert to reportedUserId/category fields matching ReportService/specs
- gdpr.service.ts + spec: replace TooManyRequestsException (not in @nestjs/common v11)
  with a local HttpException subclass using HttpStatus.TOO_MANY_REQUESTS (429)
- vet-verification.service.spec.ts: add CacheService mock (VetVerificationService
  gained this dependency but the test module was not updated)
- ipfs.service.ts: fix FormData namespace import (import * as → default import) to
  allow new FormData() construction
- jest.config.js: add moduleNameMapper for src/ and @/ path aliases so specs that
  import cross-module via absolute src/ paths resolve correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- block.entity.ts: rename blockerId/blockedId to blocker/blockedUser to match service usage; add optional blockedUserEntity property
- report.service.ts: use entity fields (reporterId, targetId, targetType, reason) instead of non-existent reporter/reportedUser/category relations; cast save() result to Report
- gdpr.service.spec.ts: use DataSource class token instead of 'DataSource' string token so NestJS DI can resolve it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ipfs.service.ts: replace new Function dynamic import with regular import() so Jest can mock kubo-rpc-client
- report.service.ts: cast updateDto.status to entity's ReportStatus type (different enums: enums/ vs entity file)
- gdpr.service.ts: export TooManyRequestsException so spec can import the same class
- gdpr.service.spec.ts: import TooManyRequestsException from service (fixes instanceof mismatch); fix PasswordUtil spy to use jest.spyOn(PasswordUtil, 'comparePassword'); use resetAllMocks() to clear one-time mock queues between tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…elds

After renaming blockerId/blockedId to blocker/blockedUser in block.entity.ts,
update blocking-reporting.service.ts to use the new field names consistently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: update profile forms and API services
…-607-608-polling-cleanup-memoize

fix: polling cleanup, backoff, memoization, and blob URL revocation (…
…tion

Fix: Standardize API client pattern and base URL usage (DogStark#609, DogStark#610, #…
feat: phone OTP verification, Jest runner, and wallet unit tests
…oading-skeleton

Add dashboard loading skeleton
…ators

feat(zkp): add per-operation loading indicators to ZkpVaccinationProof
…prod-console-logs

fix: suppress console logs in production builds in _app.tsx
…602-603

fix: resolve issues DogStark#600-603 - ARIA attrs, date/currency/range utils
…age-scripts

fix: align root package scripts with README and setup docs
…ssues-525-526-527-528

Add unit tests for useWallet, stellarSync, useBlockchainSync, and twoFactorUtils
…0-531-532

feat: implement useZkp hook + unit tests for auth, debounce, and zkp
…st-data

fix: type estimateCost data parameter, remove any
…-assertion

fix: replace non-null assertion with optional chaining in Sidebar
fix: add admin auth guard to security API routes
feat(accessibility): add aria-labels to review section action buttons
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Jambox11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@llinsss llinsss merged commit 053d681 into DogStark:main Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants