(options?: {
existingPaths?: Record<string, string>;
})
| 18 | import { encodeToBase64 } from "../../src/utils/base64"; |
| 19 | |
| 20 | function createMockApp(options?: { |
| 21 | existingPaths?: Record<string, string>; |
| 22 | }): App { |
| 23 | const existing = new Map<string, string>( |
| 24 | Object.entries(options?.existingPaths ?? {}), |
| 25 | ); |
| 26 | |
| 27 | const adapterExists = vi.fn(async (path: string) => existing.has(path)); |
| 28 | const adapterRead = vi.fn(async (path: string) => { |
| 29 | const content = existing.get(path); |
| 30 | if (content === undefined) { |
| 31 | throw new Error(`Missing: ${path}`); |
| 32 | } |
| 33 | return content; |
| 34 | }); |
| 35 | const adapterWrite = vi.fn(async (_path: string, _content: string) => { |
| 36 | /* noop for test */ |
| 37 | }); |
| 38 | |
| 39 | const createFolder = vi.fn(async (folder: string) => { |
| 40 | existing.set(folder, ""); |
| 41 | }); |
| 42 | |
| 43 | return { |
| 44 | vault: { |
| 45 | adapter: { |
| 46 | exists: adapterExists, |
| 47 | read: adapterRead, |
| 48 | write: adapterWrite, |
| 49 | }, |
| 50 | createFolder, |
| 51 | }, |
| 52 | } as unknown as App; |
| 53 | } |
| 54 | |
| 55 | describe("packageExportService", () => { |
| 56 | const QUICKADD_VERSION = "2.5.0"; |
no test coverage detected