test: Add unit test coverage for imageFallback utility

Aperta
#1,739 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 10 giorni

@swastiksharma45 ci sta già lavorando.

Dal 18/11/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
testing

Direzione di ricerca

Read frontend/src/utils/imageFallback.ts and the neighboring utility tests under frontend/src/utils/__tests__/. Add frontend/src/utils/__tests__/imageFallback.test.ts to cover the default and custom fallback, loop prevention, and the shared handler. Done means those cases have unit test coverage; the issue author reports the suite, TypeScript typecheck, ESLint, and Prettier already pass locally.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Describe the feature

The frontend/src/utils/imageFallback.ts utility centralizes error handling for <img> tags across media and memories components to prevent infinite fallback error loops. While other utilities in frontend/src/utils/ have test suites in __tests__/, imageFallback.ts currently has no test coverage.

Proposed Solution

Add a dedicated unit test suite at frontend/src/utils/__tests__/imageFallback.test.ts covering:

  • Default fallback: verifying createImageErrorHandler() swaps img.src to PLACEHOLDER_IMAGE_SRC.
  • Custom fallback: verifying custom placeholder strings when provided to createImageErrorHandler(customSrc).
  • Loop prevention: verifying that img.onerror is set to null upon error to detach the listener and prevent infinite retry loops.
  • Shared handler: verifying the exported handlePlaceholderImageError singleton.

I have already implemented and verified this test suite locally (5 tests passing, TypeScript typecheck passing, and ESLint / Prettier clean).

Could you please assign this to me so I can open the PR?

Record
  • I agree to follow this project's Code of Conduct
  • I want to work on this issue
Lingua principale
Python
Stelle
320
Fork
771
Merge medio
9g 5h
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AOSSIE-Org/PictoPy

Tutte le issue di AOSSIE-Org/PictoPy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.