mirror of
https://github.com/anomalyco/opencode.git
synced 2026-10-26 16:15:59 +00:00
25 lines
948 B
TypeScript
25 lines
948 B
TypeScript
import { describe, expect, test } from "bun:test"
|
|
import { sessionFamily } from "../../src/util/session"
|
|
|
|
describe("util.session", () => {
|
|
test("flattens nested subagents from any session in the family", () => {
|
|
const sessions = [
|
|
{ id: "root" },
|
|
{ id: "child-a", parentID: "root" },
|
|
{ id: "grandchild-a", parentID: "child-a" },
|
|
{ id: "great-grandchild-a", parentID: "grandchild-a" },
|
|
{ id: "grandchild-a2", parentID: "child-a" },
|
|
{ id: "child-b", parentID: "root" },
|
|
{ id: "grandchild-b", parentID: "child-b" },
|
|
]
|
|
|
|
expect(sessionFamily(sessions, "great-grandchild-a")).toEqual([
|
|
{ session: sessions[1], prefix: "" },
|
|
{ session: sessions[2], prefix: "├─ " },
|
|
{ session: sessions[3], prefix: "│ └─ " },
|
|
{ session: sessions[4], prefix: "└─ " },
|
|
{ session: sessions[5], prefix: "" },
|
|
{ session: sessions[6], prefix: "└─ " },
|
|
])
|
|
})
|
|
})
|