Skip to content

Commit 0fe22bf

Browse files
committed
Use globalThis localStorage in terminal state store tests
- Reference `globalThis.localStorage` in `beforeEach` - Keep storage cleanup logic consistent across test environments
1 parent 4480ff5 commit 0fe22bf

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

apps/web/src/terminalStateStore.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ const TERMINAL_STATE_STORAGE_KEY = "t3code:terminal-state:v1";
88

99
describe("terminalStateStore actions", () => {
1010
beforeEach(() => {
11-
if (typeof localStorage?.clear === "function") {
12-
localStorage.clear();
13-
} else if (typeof localStorage?.removeItem === "function") {
14-
localStorage.removeItem(TERMINAL_STATE_STORAGE_KEY);
11+
const storage = globalThis.localStorage;
12+
if (typeof storage?.clear === "function") {
13+
storage.clear();
14+
} else if (typeof storage?.removeItem === "function") {
15+
storage.removeItem(TERMINAL_STATE_STORAGE_KEY);
1516
}
1617
useTerminalStateStore.setState({ terminalStateByThreadId: {} });
1718
});

0 commit comments

Comments
 (0)