Skip to content

🧹 Janitor: Refactor setupTestServer in index_test.go to return parsed URL - #201

Draft
google-labs-jules[bot] wants to merge 1 commit into
masterfrom
janitor/refactor-setuptestserver-return-url-10629146483867260432
Draft

🧹 Janitor: Refactor setupTestServer in index_test.go to return parsed URL#201
google-labs-jules[bot] wants to merge 1 commit into
masterfrom
janitor/refactor-setuptestserver-return-url-10629146483867260432

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

Assumptions

  • The tests all need the parsed *url.URL from the server URL, which can be done inside the server setup helper to avoid duplication.
  • There are no concurrent writes to the URL making it safe to parse immediately after setup.

Alternatives Not Chosen

  • Returning a raw string server URL and keeping the url.Parse logic in the tests (rejected as it retains the duplicate code blocks).
  • Creating a separate helper like setupTestServerWithURL (rejected as it adds unnecessary surface area when all current callers need the URL anyway).

How To Pivot

  • If there are tests that require the server but do not need the URL parsed, setupTestServer could be reverted to its original signature, and a new setupTestServerWithURL could be introduced, or the url.Parse could just be done manually in tests that actually need it.

Next Knobs

  • Abstract the dummy HTTP handlers out of individual tests if there are multiple similar handlers.
  • Create more helper functions for creating mock requests (like httptest.NewRequest("GET", "/", nil)).
  • Review TestNormalizeAndValidateURL to ensure it covers all edge cases for URLs.

PR created automatically by Jules for task 10629146483867260432 started by @lucasew

… URL

Refactored `setupTestServer` to return a `*url.URL` by parsing the
server URL internally. This eliminates duplicate `url.Parse` logic
from `TestFetchAndParse`, `TestFetchAndParseRejectsNon2xx`, and
`TestFetchAndParseRejectsOversizedBody`.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 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 Jul 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
articleparser Error Error Jul 29, 2026 4:21am

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants