test: Add unit test coverage for imageFallback utility

オープン
#1,739 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 10 日以内に返信

@swastiksharma45 がすでに取り組んでいます。

2026年11月18日 から。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
testing

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
Python
スター
320
フォーク
771
平均マージ
9日 5時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AOSSIE-Org/PictoPy のほかの issue

AOSSIE-Org/PictoPy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。