| 343 | |
| 344 | // MetadataCache mock class |
| 345 | export class MetadataCache { |
| 346 | private cache = new Map<string, any>(); |
| 347 | private emitter = new EventEmitter(); |
| 348 | |
| 349 | getFileCache(file: TFile): any { |
| 350 | return this.cache.get(file.path) || null; |
| 351 | } |
| 352 | |
| 353 | getCache(path: string): any { |
| 354 | return this.cache.get(path) || null; |
| 355 | } |
| 356 | |
| 357 | setCache(path: string, metadata: any): void { |
| 358 | this.cache.set(path, metadata); |
| 359 | const file = new TFile(path); |
| 360 | this.emitter.emit('changed', file, '', metadata); |
| 361 | } |
| 362 | |
| 363 | deleteCache(path: string): void { |
| 364 | this.cache.delete(path); |
| 365 | } |
| 366 | |
| 367 | fileToLinktext(file: TFile, sourcePath: string, omitMdExtension: boolean = true): string { |
| 368 | // Simple implementation: return basename without extension if omitMdExtension is true |
| 369 | if (omitMdExtension && file.extension === 'md') { |
| 370 | return file.basename; |
| 371 | } |
| 372 | return file.name; |
| 373 | } |
| 374 | |
| 375 | // Event management |
| 376 | on(event: 'changed' | 'resolve' | 'resolved', callback: (...args: any[]) => void): void { |
| 377 | this.emitter.on(event, callback); |
| 378 | } |
| 379 | |
| 380 | off(event: 'changed' | 'resolve' | 'resolved', callback: (...args: any[]) => void): void { |
| 381 | this.emitter.off(event, callback); |
| 382 | } |
| 383 | |
| 384 | trigger(event: string, ...args: any[]): void { |
| 385 | this.emitter.emit(event, ...args); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | // FileManager mock class |
| 390 | export class FileManager { |
nothing calls this directly
no outgoing calls
no test coverage detected