web: sessions list shows active pi only; close-pi button in chat header (agent sessions); tests to 154, coverage ≥95 all metrics
This commit is contained in:
@@ -15,7 +15,7 @@ function session(p: Partial<SessionListItem>): SessionListItem {
|
||||
agent: false,
|
||||
repo: null,
|
||||
startedAt: 100,
|
||||
online: false,
|
||||
online: true,
|
||||
lastEventAt: null,
|
||||
...p,
|
||||
};
|
||||
@@ -43,9 +43,22 @@ function Probe({ onVisit }: { onVisit: (path: string) => void }): null {
|
||||
}
|
||||
|
||||
describe("SessionsView", () => {
|
||||
it("offline sessions are hidden (active only)", () => {
|
||||
renderView({
|
||||
sessions: [
|
||||
session({ id: "on", name: "live" }),
|
||||
session({ id: "off", name: "dead", online: false }),
|
||||
],
|
||||
});
|
||||
const cards = screen.getAllByRole("button", { name: /^Open session/ });
|
||||
expect(cards.map((c) => c.getAttribute("aria-label"))).toEqual([
|
||||
"Open session live",
|
||||
]);
|
||||
});
|
||||
|
||||
it("empty state message", () => {
|
||||
renderView();
|
||||
expect(screen.getByText(/No sessions yet/i)).toBeInTheDocument();
|
||||
expect(screen.getByText(/No active sessions/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders cards sorted by last activity with fallbacks", () => {
|
||||
@@ -76,8 +89,8 @@ describe("SessionsView", () => {
|
||||
"Open session a",
|
||||
]);
|
||||
expect(cards[0]?.textContent).toContain("/fallback");
|
||||
expect(screen.getAllByTitle("online")).toHaveLength(1);
|
||||
expect(screen.getAllByTitle("offline")).toHaveLength(2);
|
||||
expect(screen.getAllByTitle("online")).toHaveLength(3);
|
||||
expect(screen.queryAllByTitle("offline")).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("shows repo, model, relative time and agent badge", () => {
|
||||
|
||||
Reference in New Issue
Block a user