mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
* feat(panel): session-start, 7d overview spend, and 30d business spend charts * feat(panel): surface work sessions as a Git page tab (route was orphaned) * feat(git): reap spent task branches and render previews at lifecycle chokepoints; guarded stale-branch sweep * feat(panel): stale-branch cleanup button on the Git page * fix(git,panel): cursor-resumable sweep, force-delete spent refs, local filter state * docs(map,rag): branch/preview reaping, cleanup sweep, git-tab work sessions, wave-2 charts --------- Co-authored-by: Renn F <rennf93@users.noreply.github.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { SessionTrendChart } from "../session-trend-chart";
|
|
import { WorkSessionStatus } from "@/types";
|
|
import type { WorkSessionSummary } from "@/types";
|
|
|
|
function buildSession(overrides: Partial<WorkSessionSummary> = {}): WorkSessionSummary {
|
|
return {
|
|
id: "session-1",
|
|
task_id: "11111111-1111-1111-1111-111111111111",
|
|
branch_name: "feature/backend/ABC12345",
|
|
status: WorkSessionStatus.ACTIVE,
|
|
started_at: new Date().toISOString(),
|
|
has_pr: false,
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
describe("SessionTrendChart", () => {
|
|
it("renders the card title", () => {
|
|
render(<SessionTrendChart sessions={[buildSession()]} isLoading={false} />);
|
|
expect(screen.getByText("Active Session Starts")).toBeInTheDocument();
|
|
});
|
|
|
|
it("shows an empty state when there are no sessions", () => {
|
|
render(<SessionTrendChart sessions={[]} isLoading={false} />);
|
|
expect(screen.getByText("No active sessions")).toBeInTheDocument();
|
|
});
|
|
|
|
it("shows an empty state when sessions is undefined", () => {
|
|
render(<SessionTrendChart sessions={undefined} isLoading={false} />);
|
|
expect(screen.getByText("No active sessions")).toBeInTheDocument();
|
|
});
|
|
|
|
it("does not show the empty state while loading", () => {
|
|
render(<SessionTrendChart sessions={[]} isLoading />);
|
|
expect(screen.queryByText("No active sessions")).not.toBeInTheDocument();
|
|
});
|
|
});
|