summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/pages/layout/sidebar-workspace.test.ts
blob: d71c39fc8bf637676323c968f54fc8fdd67555c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { describe, expect, test } from "bun:test"
import { workspaceOpenState } from "./sidebar-workspace-helpers"

describe("workspaceOpenState", () => {
  test("defaults to local workspace open", () => {
    expect(workspaceOpenState({}, "/tmp/root", true)).toBe(true)
  })

  test("uses persisted expansion state when present", () => {
    expect(workspaceOpenState({ "/tmp/root": false }, "/tmp/root", true)).toBe(false)
    expect(workspaceOpenState({ "/tmp/branch": true }, "/tmp/branch", false)).toBe(true)
  })
})