import { describe, expect, it } from "vitest" import { parseSidebarPreference } from "./sidebar-preference" describe("侧栏持久化值", () => { it("解析显式布尔字符串", () => { expect(parseSidebarPreference("true", false)).toBe(true) expect(parseSidebarPreference("false", true)).toBe(false) }) it("损坏或缺失值回退设置默认值", () => { expect(parseSidebarPreference("collapsed", false)).toBe(false) expect(parseSidebarPreference(null, true)).toBe(true) }) })