mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-29 17:27:02 +00:00
fix(app): permission indicator
This commit is contained in:
@@ -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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user