Skip to content

test(download): cover parseGithubURL branches - #1046

Merged
skevetter merged 2 commits into
mainfrom
pkg-system-platform/download-parseurl-tests
Aug 18, 2026
Merged

skevetter merged 2 commits into
mainfrom
pkg-system-platform/download-parseurl-tests

Conversation

@devsy-app

@devsy-app devsy-app Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Package reviewed

pkg/download (system/platform category).

Issue found

parseGithubURL is a branching path parser that extracts the GitHub org, repo, asset file name, and optional tag from a release download URL. It had zero test coverage — none of its valid paths (latest release, tagged release, with/without leading slash) or rejection paths (too few/many segments, missing releases segment, unknown middle segment, latest without download, empty path, root slash) were exercised. A regression in the parser would silently break release-asset downloads with no test to catch it.

Change

Add table-driven tests in pkg/download/download_test.go:

  • TestParseGithubURLValid — latest release, tagged release, and both without a leading slash, asserting the parsed org/repo/file/tag.
  • TestParseGithubURLInvalid — too few segments, too many segments, missing releases segment, unknown middle segment, latest without download, empty path, and root slash, asserting a non-nil error.

Shared literals are extracted as constants (testGithubOrg, testGithubRepo, testGithubFile, testGithubTag) to satisfy goconst, and the single test function was split into valid/invalid groups to satisfy funlen. No production code changed.

Verification

  • task cli:lint:ci — 0 issues.
  • task cli:test — all pass except the known pre-existing pkg/git TestRepoClone* failures (stale assertion on origin/main, unrelated to this change which touches only pkg/download).
  • Focused run: go test -run TestParseGithubURL|TestSanitizeURL ./pkg/download/... — PASS.

This PR was created by an AI agent as part of an automated daily package review job.

Add table-driven tests for parseGithubURL covering latest/tagged releases and rejection cases. pkg/download previously had zero coverage for this branching path parser.
@netlify

netlify Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit fb7196c
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a82a2496adeb60008bae98d

@netlify

netlify Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit fb7196c
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a82a2495083eb0008d165bd

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity · 0 duplication

Metric Results
Complexity 9
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@skevetter
skevetter marked this pull request as ready for review August 18, 2026 00:12
@skevetter
skevetter merged commit 484e94d into main Aug 18, 2026
76 checks passed
@skevetter
skevetter deleted the pkg-system-platform/download-parseurl-tests branch August 18, 2026 06:19
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