Skip to content

Commit 0e4cf57

Browse files
snomiaoclaude
andcommitted
test: fix gh.spec.ts 404 error test by adding proper JSON response body
The test was returning an empty response body (null) which caused Octokit to not properly parse the error status. Updated to return a proper JSON error response with message and documentation_url, consistent with other error handling tests in the file. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent cd11dc6 commit 0e4cf57

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/gh.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,19 @@ describe("GitHub API Client (gh)", () => {
347347
// Mock a 404 response for lightweight tags
348348
server.use(
349349
http.get("https://api.github.com/repos/:owner/:repo/git/tags/:tag_sha", () => {
350-
return new HttpResponse(null, {
351-
status: 404,
352-
statusText: "Not Found",
353-
});
350+
return new HttpResponse(
351+
JSON.stringify({
352+
message: "Not Found",
353+
documentation_url: "https://docs.github.com/rest/reference/git#get-a-tag",
354+
}),
355+
{
356+
status: 404,
357+
statusText: "Not Found",
358+
headers: {
359+
"Content-Type": "application/json",
360+
},
361+
},
362+
);
354363
}),
355364
);
356365

0 commit comments

Comments
 (0)