Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

Summary

Completes migration away from github.com/migueleliasweb/go-github-mock by removing it from pkg/github/repositories_test.go and pkg/github/issues_test.go.

Why

Part of ongoing effort to replace external mock library with internal test infrastructure.

What changed

  • Removed migueleliasweb/go-github-mock import from repositories_test.go and issues_test.go
  • Replaced mock.NewMockedHTTPClient, mock.WithRequestMatchHandler, mock.WithRequestMatch with local equivalents (already defined in helper_test.go)
  • Updated pkg/raw/raw_mock.go to define EndpointPattern locally instead of importing from mock library
  • Extended normalizeEndpointKey() in helper_test.go to handle raw.EndpointPattern type

MCP impact

  • No tool or API changes

Prompts tested (tool changes only)

Security / limits

  • No security or limits impact

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Note: 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

  • Not needed

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
Copilot AI changed the title [WIP] Continue replacing migueleliasweb/go-github-mock Remove go-github-mock dependency from repositories_test.go and issues_test.go Dec 19, 2025
Copilot AI requested a review from JoannaaKL December 19, 2025 13:54
@JoannaaKL JoannaaKL marked this pull request as ready for review December 19, 2025 13:58
@JoannaaKL JoannaaKL requested a review from a team as a code owner December 19, 2025 13:58
Copilot AI review requested due to automatic review settings December 19, 2025 13:58
@JoannaaKL
Copy link
Contributor

@copilot these tests don't even pass, fix them

Copy link
Contributor

Copilot AI left a 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 EndpointPattern type in pkg/raw/raw_mock.go to replace the external mock library's type
  • Extended helper_test.go to handle the new raw.EndpointPattern type 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
Copy link

Copilot AI Dec 19, 2025

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

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.

3 participants