Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove test that can panic#445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionspkg/github/repository_resource.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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")
}
}
18 changes: 1 addition & 17 deletionspkg/github/repository_resource_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -94,7 +94,6 @@ func Test_repositoryResourceContentsHandler(t *testing.T) {
requestArgs map[string]any
expectError string
expectedResult any
expectedErrMsg string
}{
{
name: "missing owner",
Expand DownExpand Up@@ -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",
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Also, thisexpectError field is never actually used because all the tests setexpectedErrorMsg.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

},
{
name: "empty data",
mockedClient: mock.NewMockedHTTPClient(
Expand DownExpand Up@@ -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
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp