MCPcopy Create free account
hub / github.com/chhoumann/quickadd / createMockApp

Function createMockApp

tests/packages/packageImportService.test.ts:27–53  ·  view source on GitHub ↗
(initialFiles: Record<string, string> = {})

Source from the content-addressed store, hash-verified

25} from "../../src/services/packageImportService";
26
27function createMockApp(initialFiles: Record<string, string> = {}): App {
28 const files = new Map(Object.entries(initialFiles));
29
30 const exists = vi.fn(async (path: string) => files.has(path));
31 const read = vi.fn(async (path: string) => {
32 const content = files.get(path);
33 if (content === undefined) throw new Error(`Missing file: ${path}`);
34 return content;
35 });
36 const write = vi.fn(async (path: string, content: string) => {
37 files.set(path, content);
38 });
39 const createFolder = vi.fn(async (path: string) => {
40 files.set(path, "");
41 });
42
43 return {
44 vault: {
45 adapter: {
46 exists,
47 read,
48 write,
49 },
50 createFolder,
51 },
52 } as unknown as App;
53}
54
55function makeMacroChoice(
56 options: {

Callers 1

Calls 3

fnMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected