Files
fusion/packages/dashboard/app/utils/__tests__/githubCommentAuthor.test.ts
gsxdsm fc958bc54b FN-7178: improve review comment rendering
Render task Review tab comments with cleaner content, author context, and filter controls.

- Reuse the sanitized mailbox markdown renderer and strip GitHub HTML comments in plain-text mode.
- Add human/bot author derivation, avatars, badges, and All/Human/Bot filtering for review items.
- Cover rendering, filtering, selection pruning, and author classification with dashboard tests.
- Document the Review tab behavior and add the release changeset.

Files changed:
 .../fn-7178-task-review-comment-rendering.md       |   7 +
 docs/dashboard-guide.md                            |   1 +
 .../dashboard/app/components/TaskReviewTab.css     | 117 ++++++++++++++++
 .../dashboard/app/components/TaskReviewTab.tsx     | 144 ++++++++++++-------
 .../components/__tests__/TaskReviewTab.test.tsx    | 153 +++++++++++++++++++++
 .../utils/__tests__/githubCommentAuthor.test.ts    |  46 +++++++
 .../dashboard/app/utils/githubCommentAuthor.ts     |  33 +++++
 packages/dashboard/vitest.config.ts                |   1 +
 8 files changed, 455 insertions(+), 47 deletions(-)

Fusion-Task-Id: FN-7178

Fusion-Task-Lineage: 98269a09-3c57-492d-b433-d6ccb81d5b17

Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
2026-06-27 23:53:51 -07:00

47 lines
1.5 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { resolveReviewCommentAuthor } from "../githubCommentAuthor";
describe("resolveReviewCommentAuthor", () => {
it("classifies a human login and derives a GitHub avatar URL", () => {
expect(resolveReviewCommentAuthor("octocat")).toEqual({
author: "octocat",
authorIsBot: false,
authorAvatarUrl: "https://github.com/octocat.png?size=40",
});
});
it("classifies bracket-suffixed bot logins without deriving an avatar", () => {
expect(resolveReviewCommentAuthor("coderabbitai[bot]")).toEqual({
author: "coderabbitai[bot]",
authorIsBot: true,
authorAvatarUrl: undefined,
});
});
it("treats missing or empty pull-request logins as unknown without an avatar", () => {
expect(resolveReviewCommentAuthor()).toEqual({
author: "unknown",
authorIsBot: false,
authorAvatarUrl: undefined,
});
expect(resolveReviewCommentAuthor(" ")).toEqual({
author: "unknown",
authorIsBot: false,
authorAvatarUrl: undefined,
});
});
it("classifies reviewer-agent identities and missing direct-mode authors as agents", () => {
expect(resolveReviewCommentAuthor("reviewer-agent")).toEqual({
author: "reviewer-agent",
authorIsBot: true,
authorAvatarUrl: undefined,
});
expect(resolveReviewCommentAuthor(undefined, { reviewSource: "reviewer-agent" })).toEqual({
author: "unknown",
authorIsBot: true,
authorAvatarUrl: undefined,
});
});
});