Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

test(store): the reconnect-snapshot tests bring their own localStorage

Milind Soni32bec83b149e
diff --git a/src/state/snapshot-navigation.test.ts b/src/state/snapshot-navigation.test.ts
index fe75500c2b..188d157c81 100644
--- a/src/state/snapshot-navigation.test.ts
+++ b/src/state/snapshot-navigation.test.ts
@@ -70,7 +70,11 @@ beforeEach(async () => {
snapshot = deferred();
switchResponse = undefined;
newTaskResponse = undefined;
- localStorage.clear();
+ const stored = new Map<string, string>();
+ vi.stubGlobal("localStorage", {
+ getItem: (key: string) => stored.get(key) ?? null, setItem: (key: string, value: string) => { stored.set(key, String(value)); },
+ removeItem: (key: string) => { stored.delete(key); }, clear: () => stored.clear(),
+ });
vi.stubGlobal("EventSource", FixtureEventSource);
vi.stubGlobal("fetch", async (path: string, init?: RequestInit) => {
if (path.startsWith("/api/bots?")) {