From 8f2ad45f9fb34b131d7f14fad247981d7bf3cff8 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:11:25 +0330 Subject: [PATCH] Import tests: tests/unit/ui-store Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- tests/unit/ui-store.test.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/unit/ui-store.test.ts diff --git a/tests/unit/ui-store.test.ts b/tests/unit/ui-store.test.ts new file mode 100644 index 0000000..bd0bc51 --- /dev/null +++ b/tests/unit/ui-store.test.ts @@ -0,0 +1,28 @@ +import { beforeEach, describe, expect, it } from "vitest"; +import { useUiStore } from "@/stores/ui-store"; + +describe("ui store", () => { + beforeEach(() => { + useUiStore.setState({ + sidebarCollapsed: false, + commandOpen: false, + favorites: ["/files"], + recent: [], + density: "compact", + theme: "light", + }); + }); + + it("remembers routes without duplicates", () => { + useUiStore.getState().rememberRoute("/dashboard"); + useUiStore.getState().rememberRoute("/files"); + useUiStore.getState().rememberRoute("/dashboard"); + + expect(useUiStore.getState().recent.slice(0, 2)).toEqual(["/dashboard", "/files"]); + }); + + it("toggles favorites", () => { + useUiStore.getState().toggleFavorite("/files"); + expect(useUiStore.getState().favorites).not.toContain("/files"); + }); +});