MCPcopy Create free account
hub / github.com/OneNoteDev/WebClipper / resetFrontEndStorage

Function resetFrontEndStorage

src/tests/testModule.ts:43–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 protected afterEach() { }
42
43 private resetFrontEndStorage() {
44 let mockStorageRef = {};
45 let mockStorageCacheRef = {};
46
47 Clipper.getStoredValue = (key: string, callback: (value: string) => void, cacheValue?: boolean) => {
48 if (cacheValue) {
49 mockStorageCacheRef[key] = mockStorageRef[key];
50 }
51 callback(mockStorageRef[key]);
52 };
53 Clipper.storeValue = (key: string, value: string) => {
54 if (key in mockStorageCacheRef) {
55 mockStorageCacheRef[key] = value;
56 }
57 mockStorageRef[key] = value;
58 };
59 Clipper.preCacheStoredValues = (storageKeys: string[]) => {
60 for (let key of storageKeys) {
61 Clipper.getStoredValue(key, () => { }, true);
62 }
63 };
64 Clipper.getCachedValue = (key: string) => {
65 return mockStorageCacheRef[key];
66 };
67 }
68}

Callers 1

runTestsFunction · 0.85

Calls 1

getStoredValueMethod · 0.80

Tested by

no test coverage detected