Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 lines
511 B
TypeScript
16 lines
511 B
TypeScript
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)
|
|
})
|
|
})
|