diff --git a/server/src/__tests__/issue-comment-reopen-routes.test.ts b/server/src/__tests__/issue-comment-reopen-routes.test.ts index 4bcc6a12b84..d388d78e213 100644 --- a/server/src/__tests__/issue-comment-reopen-routes.test.ts +++ b/server/src/__tests__/issue-comment-reopen-routes.test.ts @@ -590,10 +590,20 @@ describe.sequential("issue comment reopen routes", () => { ["resume", { resume: true }], ["reopen", { reopen: true }], ])( - "rejects mention-granted non-assignee agent POST comments on closed issues with %s intent", + "allows mention-granted non-assignee agent POST comments on closed issues with %s intent without reopening", async (_name, intent) => { const mentionedAgentId = "33333333-3333-4333-8333-333333333333"; mockIssueService.getById.mockResolvedValue(makeIssue("done")); + mockIssueService.addComment.mockResolvedValue({ + id: "comment-1", + issueId: "11111111-1111-4111-8111-111111111111", + companyId: "company-1", + body: "Please continue this closed issue.", + createdAt: new Date(), + updatedAt: new Date(), + authorAgentId: mentionedAgentId, + authorUserId: null, + }); mockAccessService.decide.mockImplementation(async (input: { action?: string }) => { const allowed = input.action === "issue:comment"; return { @@ -608,12 +618,11 @@ describe.sequential("issue comment reopen routes", () => { .post("/api/issues/11111111-1111-4111-8111-111111111111/comments") .send({ body: "Please continue this closed issue.", ...intent }); - expect(res.status, JSON.stringify(res.body)).toBe(403); - expect(res.body.error).toBe("Issue is outside this actor's authorization boundary"); + expect(res.status, JSON.stringify(res.body)).toBe(201); expect(mockAccessService.decide).toHaveBeenCalledWith(expect.objectContaining({ action: "issue:comment" })); - expect(mockAccessService.decide).toHaveBeenCalledWith(expect.objectContaining({ action: "issue:mutate" })); + expect(mockAccessService.decide).not.toHaveBeenCalledWith(expect.objectContaining({ action: "issue:mutate" })); expect(mockIssueService.update).not.toHaveBeenCalled(); - expect(mockIssueService.addComment).not.toHaveBeenCalled(); + expect(mockIssueService.addComment).toHaveBeenCalled(); expect(mockHeartbeatService.wakeup).not.toHaveBeenCalled(); }, );