feat(FN-4761): sync PR reviews and surface review threads
Fusion-Task-Id: FN-4761 Fusion-Task-Lineage: b6b1ed73-c396-4dd2-b97f-366272d05c7f
This commit is contained in:
committed by
gsxdsm
parent
cfadcf3835
commit
5bde911bdb
@@ -0,0 +1,43 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { PrPanel } from "../PrPanel";
|
||||
|
||||
vi.mock("../../api", async () => {
|
||||
const actual = await vi.importActual<object>("../../api");
|
||||
return {
|
||||
...actual,
|
||||
refreshPrStatus: vi.fn(),
|
||||
fetchPrChecks: vi.fn().mockResolvedValue({ checks: [], rollup: "unknown", lastCheckedAt: new Date().toISOString() }),
|
||||
fetchPrReviews: vi.fn().mockResolvedValue({
|
||||
snapshot: {
|
||||
decision: "CHANGES_REQUESTED",
|
||||
items: [
|
||||
{ id: "r1", author: { login: "alice" }, body: "See src/index.ts:12", state: "CHANGES_REQUESTED", htmlUrl: "https://github.com/rev/1", createdAt: new Date().toISOString() },
|
||||
],
|
||||
},
|
||||
comments: [],
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe("PrPanel reviews", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it("renders synced reviewer thread and todo banner", async () => {
|
||||
render(
|
||||
<PrPanel
|
||||
taskId="FN-1"
|
||||
prInfo={{ url: "https://github.com/o/r/pull/1", number: 1, status: "open", title: "Title", headBranch: "x", baseBranch: "main", commentCount: 0 }}
|
||||
taskColumn="todo"
|
||||
prAuthAvailable
|
||||
onPrUpdated={() => {}}
|
||||
addToast={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(await screen.findByText("@alice")).toBeInTheDocument();
|
||||
expect(screen.getByText("Auto-moved to Todo — reviewer feedback ready")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -5,9 +5,10 @@ import { PrPanel } from "../PrPanel";
|
||||
vi.mock("../../api", () => ({
|
||||
refreshPrStatus: vi.fn(),
|
||||
fetchPrChecks: vi.fn(),
|
||||
fetchPrReviews: vi.fn(),
|
||||
}));
|
||||
|
||||
import { refreshPrStatus, fetchPrChecks } from "../../api";
|
||||
import { refreshPrStatus, fetchPrChecks, fetchPrReviews } from "../../api";
|
||||
|
||||
const mockAddToast = vi.fn();
|
||||
const mockOnPrUpdated = vi.fn();
|
||||
@@ -32,6 +33,7 @@ describe("PrPanel", () => {
|
||||
rollup: "unknown",
|
||||
lastCheckedAt: new Date().toISOString(),
|
||||
});
|
||||
(fetchPrReviews as ReturnType<typeof vi.fn>).mockResolvedValue({ snapshot: { decision: null, items: [] }, comments: [] });
|
||||
});
|
||||
|
||||
it("renders create button and calls onRequestCreatePr", () => {
|
||||
|
||||
Reference in New Issue
Block a user