test: Add unit test coverage for imageFallback utility
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()swapsimg.srctoPLACEHOLDER_IMAGE_SRC. - Custom fallback: verifying custom placeholder strings when provided to
createImageErrorHandler(customSrc). - Loop prevention: verifying that
img.onerroris set tonullupon error to detach the listener and prevent infinite retry loops. - Shared handler: verifying the exported
handlePlaceholderImageErrorsingleton.
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
- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue
👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)
Discussions are carried on Discord.
Instead of commenting here, join the AOSSIE Discord server and go to Projects → PictoPy.
If you find this project useful, a GitHub star would be appreciated.
@rohan-pandeyy i want to work on this issue can i get assigned to it?
@swastiksharma45 Hi! As noted in the issue description, I discovered this gap, opened the issue, and already have the test suite implemented and verified locally. Waiting on @rohan-pandeyy's confirmation to open the PR.