githubAPIURL() in cmd/review-bot/main.go contains non-trivial URL-derivation logic: it maps https://github.com → https://api.github.com and maps any other host (GHES) → <host>/api/v3. This function has no unit tests in main_test.go.
Go patterns require public functions (and significant private helpers used in routing) to have test coverage. An incorrect GHES URL will silently cause all GitHub API calls to fail at runtime without a clear error message.
Source
PR: #131 — feat: implement GitHub API methods and VCS routing (issue #130)
Code quality rule: Test table driven / missing tests for new/modified functions
File: cmd/review-bot/main.go line 695–706
What needs to happen
Add TestGithubAPIURL in cmd/review-bot/main_test.go with table-driven cases covering:
## What was missed
`githubAPIURL()` in `cmd/review-bot/main.go` contains non-trivial URL-derivation logic: it maps `https://github.com` → `https://api.github.com` and maps any other host (GHES) → `<host>/api/v3`. This function has no unit tests in `main_test.go`.
Go patterns require public functions (and significant private helpers used in routing) to have test coverage. An incorrect GHES URL will silently cause all GitHub API calls to fail at runtime without a clear error message.
## Source
- PR: #131 — feat: implement GitHub API methods and VCS routing (issue #130)
- Code quality rule: Test table driven / missing tests for new/modified functions
- File: `cmd/review-bot/main.go` line 695–706
## What needs to happen
Add `TestGithubAPIURL` in `cmd/review-bot/main_test.go` with table-driven cases covering:
- Empty string → `https://api.github.com`
- `https://github.com` → `https://api.github.com`
- `https://github.com/` (trailing slash) → `https://api.github.com`
- `https://ghe.example.com` → `https://ghe.example.com/api/v3`
- `https://github.concur.com` → `https://github.concur.com/api/v3` (GHES with concur domain does NOT map to api.github.com)
## References
- [PR #131](https://gitea.weiker.me/rodin/review-bot/pulls/131)
- [Issue #130](https://gitea.weiker.me/rodin/review-bot/issues/130)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What was missed
githubAPIURL()incmd/review-bot/main.gocontains non-trivial URL-derivation logic: it mapshttps://github.com→https://api.github.comand maps any other host (GHES) →<host>/api/v3. This function has no unit tests inmain_test.go.Go patterns require public functions (and significant private helpers used in routing) to have test coverage. An incorrect GHES URL will silently cause all GitHub API calls to fail at runtime without a clear error message.
Source
cmd/review-bot/main.goline 695–706What needs to happen
Add
TestGithubAPIURLincmd/review-bot/main_test.gowith table-driven cases covering:https://api.github.comhttps://github.com→https://api.github.comhttps://github.com/(trailing slash) →https://api.github.comhttps://ghe.example.com→https://ghe.example.com/api/v3https://github.concur.com→https://github.concur.com/api/v3(GHES with concur domain does NOT map to api.github.com)References