diff --git a/pkg/github/repository_resource.go b/pkg/github/repository_resource.go index 949157f5..fe34689f 100644 --- a/pkg/github/repository_resource.go +++ b/pkg/github/repository_resource.go @@ -201,6 +201,7 @@ func RepositoryResourceContentsHandler(getClient GetClientFn) func(ctx context.C } } + // This should be unreachable because GetContents should return an error if neither file nor directory content is found. return nil, errors.New("no repository resource content found") } } diff --git a/pkg/github/repository_resource_test.go b/pkg/github/repository_resource_test.go index ffd14be3..f6a47e8c 100644 --- a/pkg/github/repository_resource_test.go +++ b/pkg/github/repository_resource_test.go @@ -94,7 +94,6 @@ func Test_repositoryResourceContentsHandler(t *testing.T) { requestArgs map[string]any expectError string expectedResult any - expectedErrMsg string }{ { name: "missing owner", @@ -180,21 +179,6 @@ func Test_repositoryResourceContentsHandler(t *testing.T) { }, expectedResult: expectedDirContent, }, - { - name: "no data", - mockedClient: mock.NewMockedHTTPClient( - mock.WithRequestMatch( - mock.GetReposContentsByOwnerByRepoByPath, - ), - ), - requestArgs: map[string]any{ - "owner": []string{"owner"}, - "repo": []string{"repo"}, - "path": []string{"src"}, - }, - expectedResult: nil, - expectError: "no repository resource content found", - }, { name: "empty data", mockedClient: mock.NewMockedHTTPClient( @@ -248,7 +232,7 @@ func Test_repositoryResourceContentsHandler(t *testing.T) { resp, err := handler(context.TODO(), request) if tc.expectError != "" { - require.ErrorContains(t, err, tc.expectedErrMsg) + require.ErrorContains(t, err, tc.expectError) return }