Spaces:
Running
Running
File size: 1,577 Bytes
837e3ac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import { renderToStaticMarkup } from "react-dom/server";
import { describe, expect, it } from "vitest";
import { AgentLogPanel, buildAgentLogExportText } from "./AgentLogPanel";
describe("AgentLogPanel", () => {
it("renders logs in chronological order so scrolling upward reveals older activity", () => {
const html = renderToStaticMarkup(
<AgentLogPanel
busy={false}
logs={[
{
id: "log-1",
title: "First event",
detail: "Hydrated the board.",
level: "info",
createdAt: "2026-01-01T10:00:00.000Z",
},
{
id: "log-2",
title: "Second event",
detail: "Opened the package detail view.",
level: "success",
createdAt: "2026-01-01T10:01:00.000Z",
},
]}
/>,
);
expect(html.indexOf("First event")).toBeLessThan(html.indexOf("Second event"));
});
it("exports thinking lines in the plain-text log export", () => {
const content = buildAgentLogExportText({
busy: true,
logs: [
{
id: "log-1",
title: "Thinking",
detail: "Resolved scope to System Requirements Specification.",
level: "info",
createdAt: "2026-01-01T10:00:00.000Z",
},
],
});
expect(content).toContain("Agent Log Export");
expect(content).toContain("Status: Running");
expect(content).toContain("Thinking");
expect(content).toContain("Resolved scope to System Requirements Specification.");
});
});
|