mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-23 06:54:13 +08:00
prettier
This commit is contained in:
@@ -9,8 +9,17 @@ type PrepareConfigParams = {
|
|||||||
claudeCommentId?: string;
|
claudeCommentId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function prepareMcpConfig(params: PrepareConfigParams): Promise<string> {
|
export async function prepareMcpConfig(
|
||||||
const { githubToken, owner, repo, branch, additionalMcpConfig, claudeCommentId } = params;
|
params: PrepareConfigParams,
|
||||||
|
): Promise<string> {
|
||||||
|
const {
|
||||||
|
githubToken,
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
branch,
|
||||||
|
additionalMcpConfig,
|
||||||
|
claudeCommentId,
|
||||||
|
} = params;
|
||||||
try {
|
try {
|
||||||
const baseMcpConfig = {
|
const baseMcpConfig = {
|
||||||
mcpServers: {
|
mcpServers: {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { Octokit } from "@octokit/rest";
|
|||||||
import {
|
import {
|
||||||
updateClaudeComment,
|
updateClaudeComment,
|
||||||
type UpdateClaudeCommentParams,
|
type UpdateClaudeCommentParams,
|
||||||
type UpdateClaudeCommentResult,
|
|
||||||
} from "../src/github/operations/comments/update-claude-comment";
|
} from "../src/github/operations/comments/update-claude-comment";
|
||||||
|
|
||||||
describe("updateClaudeComment", () => {
|
describe("updateClaudeComment", () => {
|
||||||
@@ -33,7 +32,9 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -70,7 +71,9 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -107,7 +110,9 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.pulls.updateReviewComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -147,9 +152,13 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockRejectedValue(mockError);
|
mockOctokit.rest.pulls.updateReviewComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockRejectedValue(mockError);
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -187,7 +196,9 @@ describe("updateClaudeComment", () => {
|
|||||||
mockError.status = 500;
|
mockError.status = 500;
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockRejectedValue(mockError);
|
mockOctokit.rest.pulls.updateReviewComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockRejectedValue(mockError);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -197,7 +208,9 @@ describe("updateClaudeComment", () => {
|
|||||||
isPullRequestReviewComment: true,
|
isPullRequestReviewComment: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(mockError);
|
await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(
|
||||||
|
mockError,
|
||||||
|
);
|
||||||
|
|
||||||
expect(mockOctokit.rest.pulls.updateReviewComment).toHaveBeenCalledWith({
|
expect(mockOctokit.rest.pulls.updateReviewComment).toHaveBeenCalledWith({
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -214,7 +227,9 @@ describe("updateClaudeComment", () => {
|
|||||||
const mockError = new Error("Forbidden");
|
const mockError = new Error("Forbidden");
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockRejectedValue(mockError);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockRejectedValue(mockError);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -224,7 +239,9 @@ describe("updateClaudeComment", () => {
|
|||||||
isPullRequestReviewComment: false,
|
isPullRequestReviewComment: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(mockError);
|
await expect(updateClaudeComment(mockOctokit, params)).rejects.toEqual(
|
||||||
|
mockError,
|
||||||
|
);
|
||||||
|
|
||||||
expect(mockOctokit.rest.issues.updateComment).toHaveBeenCalledWith({
|
expect(mockOctokit.rest.issues.updateComment).toHaveBeenCalledWith({
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -245,7 +262,9 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -276,7 +295,9 @@ describe("updateClaudeComment", () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -325,7 +346,9 @@ const code = "example";
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.issues.updateComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.issues.updateComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
@@ -366,7 +389,9 @@ const code = "example";
|
|||||||
};
|
};
|
||||||
|
|
||||||
// @ts-expect-error Mock implementation doesn't match full type signature
|
// @ts-expect-error Mock implementation doesn't match full type signature
|
||||||
mockOctokit.rest.pulls.updateReviewComment = jest.fn().mockResolvedValue(mockResponse);
|
mockOctokit.rest.pulls.updateReviewComment = jest
|
||||||
|
.fn()
|
||||||
|
.mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
const params: UpdateClaudeCommentParams = {
|
const params: UpdateClaudeCommentParams = {
|
||||||
owner: "testowner",
|
owner: "testowner",
|
||||||
|
|||||||
Reference in New Issue
Block a user