This PR removes hardcoded mock data from the vaccination compliance#639
Merged
Conversation
…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
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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