Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
95 changes: 0 additions & 95 deletions src/lib/__tests__/github/fetchRepositories.test.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ type RepositoriesResponse = {
* @throws {UserNotFoundError} ユーザーが存在しない場合
* @throws {RateLimitError} APIレート制限に達した場合
*/
export const fetchRepositories = cache(async function fetchRepositories(
const fetchRepositories = cache(async function fetchRepositories(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Removing the export keyword from fetchRepositories prevents it from being directly unit-tested, which led to the deletion of fetchRepositories.test.ts.

fetchRepositories contains significant business logic, including:

  • GraphQL response parsing and language statistics calculation.
  • REST API fallback when no token is provided.
  • Custom error handling (e.g., UserNotFoundError).

Deleting these unit tests reduces test coverage and makes it harder to isolate and debug issues in this function. When refactoring, ensure that existing test cases for error handling (such as upstream service failures, rate limits, or not-found errors) are preserved to maintain robust coverage.

Suggested change
const fetchRepositories = cache(async function fetchRepositories(
export const fetchRepositories = cache(async function fetchRepositories(
References
  1. When refactoring API routes, ensure that existing test cases for error handling (such as upstream service failures, rate limits, or not-found errors) are preserved to maintain robust coverage.

username: string,
token?: string
): Promise<RepositoryData> {
Expand Down
Loading