Skip to content

Commit 865f9bf

Browse files
authored
Prefer already-defined endpoint mock (#226)
1 parent 01aefd3 commit 865f9bf

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pkg/github/repositories_test.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,6 @@ func Test_GetCommit(t *testing.T) {
517517
},
518518
},
519519
}
520-
// This one currently isn't defined in the mock package we're using.
521-
var mockEndpointPattern = mock.EndpointPattern{
522-
Pattern: "/repos/{owner}/{repo}/commits/{sha}",
523-
Method: "GET",
524-
}
525520

526521
tests := []struct {
527522
name string
@@ -535,7 +530,7 @@ func Test_GetCommit(t *testing.T) {
535530
name: "successful commit fetch",
536531
mockedClient: mock.NewMockedHTTPClient(
537532
mock.WithRequestMatchHandler(
538-
mockEndpointPattern,
533+
mock.GetReposCommitsByOwnerByRepoByRef,
539534
mockResponse(t, http.StatusOK, mockCommit),
540535
),
541536
),
@@ -551,7 +546,7 @@ func Test_GetCommit(t *testing.T) {
551546
name: "commit fetch fails",
552547
mockedClient: mock.NewMockedHTTPClient(
553548
mock.WithRequestMatchHandler(
554-
mockEndpointPattern,
549+
mock.GetReposCommitsByOwnerByRepoByRef,
555550
http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
556551
w.WriteHeader(http.StatusNotFound)
557552
_, _ = w.Write([]byte(`{"message": "Not Found"}`))

0 commit comments

Comments
 (0)