MCPcopy Index your code
hub / github.com/tinyplex/tinybase / createMockStorage

Function createMockStorage

test/unit/persisters/partykit.test.ts:39–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37};
38
39const createMockStorage = (): MockStorage => {
40 const map = new Map<string, StorageValue>();
41 return {
42 get: async <Value>(key: string): Promise<Value | undefined> =>
43 map.get(key) as Value | undefined,
44 list: async <Value>(): Promise<Map<string, Value>> =>
45 map as unknown as Map<string, Value>,
46 put: async (entries: {[key: string]: StorageValue}): Promise<void> => {
47 Object.entries(entries).forEach(([key, value]) => map.set(key, value));
48 },
49 delete: async (keys: string[]): Promise<void> => {
50 keys.forEach((key) => map.delete(key));
51 },
52 };
53};
54
55const createMockEnvironment = (
56 config: TinyBasePartyKitServerConfig = {},

Callers 1

createMockEnvironmentFunction · 0.85

Calls 2

getMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…