Skip to content

Commit

Permalink
Fix: string /repos/owner/repo/pulls has 3 occurrences, make it a cons…
Browse files Browse the repository at this point in the history
…tant (goconst)
  • Loading branch information
nao1215 committed Feb 23, 2023
1 parent d5e0589 commit 073251e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions infrastructure/github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ func TestListRepositories(t *testing.T) {
func TestClient_ListPullRequests(t *testing.T) {
t.Parallel()

const apiURL = "/repos/owner/repo/pulls"

t.Run("Get PR list", func(t *testing.T) {
t.Parallel()

now := time.Date(2023, 2, 24, 12, 34, 56, 0, time.UTC)
testServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
wantURL := "/repos/owner/repo/pulls"
wantURL := apiURL
if wantURL != req.URL.Path {
t.Errorf("mismatch want=%v, got=%s", wantURL, req.URL.Path)
}
Expand Down Expand Up @@ -318,7 +320,7 @@ func TestClient_ListPullRequests(t *testing.T) {
ctx := context.Background()

testServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
wantURL := "/repos/owner/repo/pulls"
wantURL := apiURL
if wantURL != req.URL.Path {
t.Errorf("mismatch want=%v, got=%s", wantURL, req.URL.Path)
}
Expand Down Expand Up @@ -369,7 +371,7 @@ func TestClient_ListPullRequests(t *testing.T) {
ctx := context.Background()

testServer := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
wantURL := "/repos/owner/repo/pulls"
wantURL := apiURL
if wantURL != req.URL.Path {
t.Errorf("mismatch want=%v, got=%s", wantURL, req.URL.Path)
}
Expand Down

0 comments on commit 073251e

Please sign in to comment.