fix(app): permission indicator

This commit is contained in:
Adam
2026-02-26 20:40:39 -06:00
parent e9a7c71141
commit b0b88f6792
3 changed files with 52 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import {
displayName,
errorMessage,
getDraggableId,
hasProjectPermissions,
latestRootSession,
syncWorkspaceOrder,
workspaceKey,
@@ -116,6 +117,29 @@ describe("layout workspace helpers", () => {
expect(result?.id).toBe("workspace")
})
test("detects project permissions with a filter", () => {
const result = hasProjectPermissions(
{
root: [{ id: "perm-root" }, { id: "perm-hidden" }],
child: [{ id: "perm-child" }],
},
(item) => item.id === "perm-child",
)
expect(result).toBe(true)
})
test("ignores project permissions filtered out", () => {
const result = hasProjectPermissions(
{
root: [{ id: "perm-root" }],
},
() => false,
)
expect(result).toBe(false)
})
test("ignores archived and child sessions when finding latest root session", () => {
const result = latestRootSession(
[