From 2bb3f8837b9fbcd3928206aa7178a7efafdf26b0 Mon Sep 17 00:00:00 2001 From: William Martin Date: Tue, 27 May 2025 20:05:18 +0200 Subject: [PATCH 1/2] Remove test that can panic --- pkg/github/repository_resource.go | 1 + pkg/github/repository_resource_test.go | 15 --------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/pkg/github/repository_resource.go b/pkg/github/repository_resource.go index 949157f55..fe34689fb 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 ffd14be32..0fae68926 100644 --- a/pkg/github/repository_resource_test.go +++ b/pkg/github/repository_resource_test.go @@ -180,21 +180,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( From ecb82d14b1f7882cc3a2113c0ef6692e33d88b64 Mon Sep 17 00:00:00 2001 From: William Martin Date: Tue, 27 May 2025 20:25:01 +0200 Subject: [PATCH 2/2] Fix incorrect repo resource table test --- pkg/github/repository_resource_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/github/repository_resource_test.go b/pkg/github/repository_resource_test.go index 0fae68926..f6a47e8cf 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", @@ -233,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 } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy