-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Remove go-github-mock dependency from repositories_test.go and issues_test.go #1654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
|
@copilot these tests don't even pass, fix them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR completes the migration away from the external migueleliasweb/go-github-mock library by removing it from repositories_test.go and issues_test.go, building upon the internal test infrastructure already defined in helper_test.go.
Key Changes
- Defined a local
EndpointPatterntype inpkg/raw/raw_mock.goto replace the external mock library's type - Extended
helper_test.goto handle the newraw.EndpointPatterntype in endpoint normalization - Replaced all mock function calls (
mock.NewMockedHTTPClient,mock.WithRequestMatchHandler,mock.WithRequestMatch) with their local equivalents across both test files
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/raw/raw_mock.go | Defines local EndpointPattern struct to replace dependency on external mock library |
| pkg/github/helper_test.go | Extends normalizeEndpointKey() to handle raw.EndpointPattern type for endpoint matching |
| pkg/github/repositories_test.go | Migrates all test cases from external mock functions to local equivalents (205 replacements) |
| pkg/github/issues_test.go | Migrates all test cases from external mock functions to local equivalents (142 replacements) |
| if v == nil { | ||
| panic("nil EndpointPattern") | ||
| } | ||
| return v.Method + " " + v.Pattern |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The normalizeEndpointKey function now handles raw.EndpointPattern type, but there's potential confusion between the local EndpointPattern (defined at line 582) and raw.EndpointPattern. Consider adding a comment to clarify that raw.EndpointPattern is specifically for raw content API endpoints to improve code clarity.
| return v.Method + " " + v.Pattern | |
| return v.Method + " " + v.Pattern | |
| // raw.EndpointPattern is used for raw content API endpoints (via the pkg/raw helpers), | |
| // which is distinct from the local EndpointPattern used for standard REST API tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Summary
Completes migration away from
github.com/migueleliasweb/go-github-mockby removing it frompkg/github/repositories_test.goandpkg/github/issues_test.go.Why
Part of ongoing effort to replace external mock library with internal test infrastructure.
What changed
migueleliasweb/go-github-mockimport fromrepositories_test.goandissues_test.gomock.NewMockedHTTPClient,mock.WithRequestMatchHandler,mock.WithRequestMatchwith local equivalents (already defined inhelper_test.go)pkg/raw/raw_mock.goto defineEndpointPatternlocally instead of importing from mock librarynormalizeEndpointKey()inhelper_test.goto handleraw.EndpointPatterntypeMCP impact
Prompts tested (tool changes only)
Security / limits
Lint & tests
./script/lint./script/testNote: 5 tests currently failing with JSON parse error - under investigation. Tests pass on base commit, suggesting subtle mock matching or serialization issue introduced during migration.
Docs
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.