(initialFiles: Record<string, string> = {})
| 25 | } from "../../src/services/packageImportService"; |
| 26 | |
| 27 | function 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 | |
| 55 | function makeMacroChoice( |
| 56 | options: { |
no test coverage detected