1import { describe, expect, it } from "vite-plus/test";
2
3import type { ReviewSectionItem, ReviewSectionKind } from "./reviewModel";
4import { buildReviewSectionMenu } from "./review-section-menu";
5
6function section(id: string, kind: ReviewSectionKind): ReviewSectionItem {
7 return {
8 id,
9 kind,
10 title: id,
11 subtitle: null,
12 diff: null,
13 isLoading: false,
14 };
15}
16
17describe("buildReviewSectionMenu", () => {
18 it("exposes git scopes and the latest turn at the top level", () => {
19 const turn28 = section("turn:28", "turn");
20 const turn27 = section("turn:27", "turn");
21 const workingTree = section("git:working-tree", "working-tree");
22 const branchChanges = section("git:branch-range", "branch-range");
23
24 expect(buildReviewSectionMenu([turn28, turn27, workingTree, branchChanges])).toEqual({
25 workingTree,
26 branchChanges,
27 latestTurn: turn28,
28 turns: [turn28, turn27],
29 });
30 });
31
32 it("keeps unavailable scopes empty while data loads", () => {
33 expect(buildReviewSectionMenu([])).toEqual({
34 workingTree: null,
35 branchChanges: null,
36 latestTurn: null,
37 turns: [],
38 });
39 });
40});