feat(FN-3711): consolidate graph position storage and remove scopedStorage
Consolidated graph position storage into a canonical shared helper (`projectStorage.ts`) with hardened persistence logic and removed the duplicate `scopedStorage` module. Updated integration tests and documented the canonical storage approach. A smaller fix (`FN-3628`) addressed mobile touch targets Fusion-Task-Id: FN-3711
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, beforeEach } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
GLOBAL_STORAGE_KEYS,
|
||||
@@ -115,6 +115,24 @@ describe("projectStorage", () => {
|
||||
expect(getScopedItem("kb-dashboard-working-branch-filter", "proj-3")).toBeNull();
|
||||
});
|
||||
|
||||
it("getScopedItem returns null when localStorage.getItem is unavailable", () => {
|
||||
vi.stubGlobal("window", { localStorage: {} });
|
||||
expect(getScopedItem("kb-dashboard-list-columns", "proj-abc")).toBeNull();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it("setScopedItem is a no-op when localStorage.setItem is unavailable", () => {
|
||||
vi.stubGlobal("window", { localStorage: {} });
|
||||
expect(() => setScopedItem("kb-dashboard-list-columns", "value", "proj-abc")).not.toThrow();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it("removeScopedItem is a no-op when localStorage.removeItem is unavailable", () => {
|
||||
vi.stubGlobal("window", { localStorage: {} });
|
||||
expect(() => removeScopedItem("kb-dashboard-list-columns", "proj-abc")).not.toThrow();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it("has no overlap between global and project-scoped keys", () => {
|
||||
const globalSet = new Set(GLOBAL_STORAGE_KEYS);
|
||||
const overlap = PROJECT_STORAGE_KEYS.filter((key) => globalSet.has(key));
|
||||
|
||||
Reference in New Issue
Block a user