summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/pages/layout/helpers.test.ts
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-04-07 11:06:23 -0500
committerGitHub <[email protected]>2026-04-07 11:06:23 -0500
commitec8b9810b4231cd6a5c69ccd930b6c50999fc997 (patch)
tree562313d6dd3eda9891f3a4a3a2ef6ce3d36acd05 /packages/app/src/pages/layout/helpers.test.ts
parent65318a80f7a3320ba77b749241f8de997dc65c82 (diff)
downloadopencode-ec8b9810b4231cd6a5c69ccd930b6c50999fc997.tar.gz
opencode-ec8b9810b4231cd6a5c69ccd930b6c50999fc997.zip
feat(app): better subagent experience (#20708)
Diffstat (limited to 'packages/app/src/pages/layout/helpers.test.ts')
-rw-r--r--packages/app/src/pages/layout/helpers.test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/app/src/pages/layout/helpers.test.ts b/packages/app/src/pages/layout/helpers.test.ts
index 1fe52d47a..988332ab7 100644
--- a/packages/app/src/pages/layout/helpers.test.ts
+++ b/packages/app/src/pages/layout/helpers.test.ts
@@ -8,6 +8,7 @@ import {
} from "./deep-links"
import { type Session } from "@opencode-ai/sdk/v2/client"
import {
+ childSessionOnPath,
displayName,
effectiveWorkspaceOrder,
errorMessage,
@@ -198,6 +199,19 @@ describe("layout workspace helpers", () => {
expect(result?.id).toBe("root")
})
+ test("finds the direct child on the active session path", () => {
+ const list = [
+ session({ id: "root", directory: "/workspace" }),
+ session({ id: "child", directory: "/workspace", parentID: "root" }),
+ session({ id: "leaf", directory: "/workspace", parentID: "child" }),
+ ]
+
+ expect(childSessionOnPath(list, "root", "leaf")?.id).toBe("child")
+ expect(childSessionOnPath(list, "child", "leaf")?.id).toBe("leaf")
+ expect(childSessionOnPath(list, "root", "root")).toBeUndefined()
+ expect(childSessionOnPath(list, "root", "other")).toBeUndefined()
+ })
+
test("formats fallback project display name", () => {
expect(displayName({ worktree: "/tmp/app" })).toBe("app")
expect(displayName({ worktree: "/tmp/app", name: "My App" })).toBe("My App")