Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
29 lines
825 B
TypeScript
29 lines
825 B
TypeScript
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");
|
|
});
|
|
});
|