MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / createMockApp

Function createMockApp

tests/performance/filterCache.performance.test.ts:28–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28function createMockApp(): MockApp {
29 const files = new Map<string, TFile>();
30 const metadata = new Map<string, { frontmatter: Record<string, unknown> }>();
31
32 const app = {
33 __files: files,
34 __metadata: metadata,
35 __metadataReads: 0,
36 vault: {
37 getMarkdownFiles: jest.fn(() => Array.from(files.values())),
38 getAbstractFileByPath: jest.fn((path: string) => files.get(path) ?? null),
39 on: jest.fn(() => ({})),
40 },
41 metadataCache: {
42 getFileCache: jest.fn((file: TFile) => {
43 app.__metadataReads++;
44 return metadata.get(file.path) ?? null;
45 }),
46 on: jest.fn(() => ({})),
47 offref: jest.fn(),
48 },
49 } as unknown as MockApp;
50
51 return app;
52}
53
54function createFile(app: MockApp, path: string, frontmatter: Record<string, unknown>): void {
55 const file = new TFile(path);

Callers 1

createLargeFilterFixtureFunction · 0.70

Calls 1

getMethod · 0.65

Tested by

no test coverage detected