MCPcopy Create free account
hub / github.com/chhoumann/quickadd / createEngine

Function createEngine

src/engine/TemplateChoiceEngine.folderSorting.test.ts:94–126  ·  view source on GitHub ↗
(
	choice: ITemplateChoice,
	folders: string[],
	activeFile: TFile | null = null,
)

Source from the content-addressed store, hash-verified

92}
93
94function 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
128function getSuggestedItems(): string[] {
129 return inputSuggestMock.mock.calls[0]?.[2] as string[];

Calls 1

fnMethod · 0.80

Tested by

no test coverage detected