MCPcopy
hub / github.com/pingdotgg/t3code / createLocalStorageStub

Function createLocalStorageStub

apps/web/src/uiStateStore.test.ts:216–234  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214});
215
216function createLocalStorageStub(): Storage {
217 const store = new Map<string, string>();
218 return {
219 clear: () => {
220 store.clear();
221 },
222 getItem: (key) => store.get(key) ?? null,
223 key: (index) => [...store.keys()][index] ?? null,
224 get length() {
225 return store.size;
226 },
227 removeItem: (key) => {
228 store.delete(key);
229 },
230 setItem: (key, value) => {
231 store.set(key, value);
232 },
233 };
234}
235
236describe("uiStateStore persistence", () => {
237 let localStorageStub: Storage;

Callers 1

Calls 4

clearMethod · 0.80
getMethod · 0.80
deleteMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected