Add tree navigation tests and shared test utilities

- Add test/utilities.ts with shared helpers (API_KEY, userMsg, assistantMsg, createTestSession)
- Add agent-session-tree-navigation.test.ts with e2e tests for tree navigation
- Add getChildren() method to SessionManager
- Add summaryEntry to navigateTree return type
- Update existing tests to use shared utilities
This commit is contained in:
Mario Zechner 2025-12-29 20:30:13 +01:00
parent 01dae9ebcc
commit 31c5cd38d1
7 changed files with 494 additions and 30 deletions

View file

@ -1,29 +1,6 @@
import { describe, expect, it } from "vitest";
import { type CustomEntry, SessionManager } from "../../src/core/session-manager.js";
function userMsg(text: string) {
return { role: "user" as const, content: text, timestamp: Date.now() };
}
function assistantMsg(text: string) {
return {
role: "assistant" as const,
content: [{ type: "text" as const, text }],
api: "anthropic-messages" as const,
provider: "anthropic",
model: "test",
usage: {
input: 1,
output: 1,
cacheRead: 0,
cacheWrite: 0,
totalTokens: 2,
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
},
stopReason: "stop" as const,
timestamp: Date.now(),
};
}
import { assistantMsg, userMsg } from "../utilities.js";
describe("SessionManager append and tree traversal", () => {
describe("append operations", () => {