( choice: ITemplateChoice, folders: string[], activeFile: TFile | null = null, )
| 92 | } |
| 93 | |
| 94 | function createEngine( |
| 95 | choice: ITemplateChoice, |
| 96 | folders: string[], |
| 97 | activeFile: TFile | null = null, |
| 98 | ) { |
| 99 | const app = { |
| 100 | plugins: { |
| 101 | plugins: {}, |
| 102 | }, |
| 103 | workspace: { |
| 104 | getActiveFile: vi.fn(() => activeFile), |
| 105 | }, |
| 106 | vault: { |
| 107 | getAllLoadedFiles: vi.fn(() => folders.map(createFolder)), |
| 108 | adapter: { |
| 109 | exists: vi.fn(async () => false), |
| 110 | }, |
| 111 | createFolder: vi.fn(), |
| 112 | }, |
| 113 | } as unknown as App; |
| 114 | |
| 115 | const plugin = { |
| 116 | settings: { |
| 117 | globalVariables: {}, |
| 118 | }, |
| 119 | } as any; |
| 120 | const choiceExecutor: IChoiceExecutor = { |
| 121 | execute: vi.fn(), |
| 122 | variables: new Map<string, unknown>(), |
| 123 | }; |
| 124 | |
| 125 | return new TemplateChoiceEngine(app, plugin, choice, choiceExecutor); |
| 126 | } |
| 127 | |
| 128 | function getSuggestedItems(): string[] { |
| 129 | return inputSuggestMock.mock.calls[0]?.[2] as string[]; |
no test coverage detected