test: cover response-less PapyrusError branch in health checks#285
Conversation
…ealth checks `healthCheck()` maps a `PapyrusError` with no `response` to `HealthCheckResult(.fail, detail: error.message)` (the connection-level failure path, before any HTTP response). Existing tests covered `.pass`, HTTP-code, HTTP-(-1), and generic `Error`, but never a response-less `PapyrusError`, leaving that branch (line 46) uncovered. Add the missing case to both suites — region coverage 75.00% -> 87.50% on each file. The remaining gap is the live `init()` URLSession closure, which is a real network call and structurally uncoverable in unit tests.
|
Warning Review limit reached
More reviews will be available in 9 minutes and 19 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
カバレッジ調査の一環で見つけた、未カバーかつクリーンに埋められる分岐を補う test-only PR。
背景
MusicBrainzHealthCheck.healthCheck()/LRCLibHealthCheck.healthCheck()は、responseを持たないPapyrusError(HTTP レスポンス到達前の接続レベル失敗)をHealthCheckResult(.fail, detail: error.message)にマッピングする。既存テストは.pass/ HTTP コード / HTTP -1 / 汎用Errorを網羅していたが、response なしのPapyrusErrorだけ抜けており、この分岐(各ファイル46行目)が未カバーだった。変更
PapyrusError→error.message」ケースを追加残る2 region は live な
init()のURLSessionクロージャ(実ネットワーク呼び出し)で、unit test では構造的にカバー不能。調査メモ(カバレッジ全体)
ignore 対象(
Domain/**・DependencyInjection/**)を除いた全体は line 96.4% / region 91.1% で既に高い。残るギャップの大半は OS 依存で unit test 困難:Views/Overlay/AppWindow.swiftViews/Shared/DisplayLinkDriver.swiftinit()WallpaperDataSource/FindExecutable.swiftのwhichfallbackProcessspawn・PATH 依存(flaky)→ この PR の health-check 分岐が、構造的でなく素直に埋められる数少ないケースだったため対応。
テスト
swift test全 939 件 green(+2)。バージョン
2.13.19→2.13.20(patch / test)