Import tests: tests/unit/ui-store
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -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");
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user