Skip to content

🧪 Add error path test for isTrustedFontUrl - #529

Open
is0692vs wants to merge 1 commit into
mainfrom
test-is-trusted-font-url-error-path-2746097402454726665
Open

🧪 Add error path test for isTrustedFontUrl#529
is0692vs wants to merge 1 commit into
mainfrom
test-is-trusted-font-url-error-path-2746097402454726665

Conversation

@is0692vs

@is0692vs is0692vs commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎯 What: Added missing test for error path in isTrustedFontUrl.
📊 Coverage: The catch block in isTrustedFontUrl is now covered when new URL() throws due to an unparseable URL.
Result: Improved test coverage for validators.ts to 100% lines and branches covered.


PR created automatically by Jules for task 2746097402454726665 started by @is0692vs

Greptile Summary

isTrustedFontUrl に解析不能な文字列を渡した場合、例外を外部へ伝播せず false を返すことを検証する単体テストを追加しています。

  • new URL() が例外を送出する入力によって catch 分岐を直接カバー
  • 本番コード、公開契約、セキュリティ境界への変更はなし

Confidence Score: 5/5

本番動作を変更せず、追加テストも意図した例外処理を安定して検証しているため、安全にマージできると考えます。

not-a-valid-url は対象の URL 解析で例外となり、既存の catch 分岐から false が返されるため、ビルドや実行時契約を壊す変更は確認されませんでした。

Important Files Changed

Filename Overview
src/lib/tests/validators.test.ts 解析不能なフォントURLが安全に拒否されることを確認する、決定的で安定したテストの追加です。

Reviews (1): Last reviewed commit: "test: add error path test for isTrustedF..." | Re-trigger Greptile

Context used:

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
github-user-summary Ignored Ignored Aug 7, 2026 6:44am

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@is0692vs, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 961dc6c9-407e-4cc4-a38b-210e666113b7

📥 Commits

Reviewing files that changed from the base of the PR and between eb95c48 and cf889a8.

📒 Files selected for processing (1)
  • src/lib/__tests__/validators.test.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add test coverage for isTrustedFontUrl unparseable-URL error path

🧪 Tests 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add a unit test to exercise the isTrustedFontUrl catch-block when URL parsing fails.
• Ensure invalid/unparseable input returns false without throwing.
• Increase validators.ts branch/line coverage by covering the error path.
Diagram

graph TD
  T["validators.test.ts"] -->|calls| V["isTrustedFontUrl()"] --> U["new URL()"] --> D{"Parse error?"}
  D -->|throws| C["catch: false"]
  D -->|ok| P["validate origin/path"]

  subgraph Legend
    direction LR
    _test["Test"] ~~~ _fn["Function"] ~~~ _dec{"Decision"}
  end
Loading
High-Level Assessment

Current approach (passing an intentionally unparseable URL string and asserting false) is the simplest and most realistic way to cover the catch block without introducing mocks or test-only seams.

Files changed (1) +4 / -0

Tests (1) +4 / -0
validators.test.tsCover isTrustedFontUrl URL-parse failure (catch) path +4/-0

Cover isTrustedFontUrl URL-parse failure (catch) path

• Adds a new unit test that passes an unparseable URL string into isTrustedFontUrl. Verifies the function handles URL() constructor failures by returning false instead of throwing.

src/lib/tests/validators.test.ts

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant