Skip to content

Commit 05d7304

Browse files
committed
fix: remove default implementation of mock
1 parent 086e0f7 commit 05d7304

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

mocks/obsidian.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -181,37 +181,9 @@ export const _prepareSimpleSearchMock = {
181181
behavior: null as ((query: string) => (text: string) => null | SearchResult) | null,
182182
};
183183

184-
// Default implementation (can be overridden by tests)
185-
function defaultPrepareSimpleSearch(
186-
query: string
187-
): (value: string) => null | SearchResult {
188-
return (text: string) => {
189-
const matches: [number, number][] = [];
190-
const lowerQuery = query.toLowerCase();
191-
const lowerText = text.toLowerCase();
192-
193-
let index = 0;
194-
while ((index = lowerText.indexOf(lowerQuery, index)) !== -1) {
195-
matches.push([index, index + query.length]);
196-
index += query.length;
197-
}
198-
199-
if (matches.length === 0) {
200-
return null;
201-
}
202-
203-
const result = new SearchResult();
204-
result.matches = matches;
205-
result.score = matches.length * -10;
206-
return result;
207-
};
208-
}
209-
210-
export function prepareSimpleSearch(
211-
query: string
212-
): (value: string) => null | SearchResult {
184+
export function prepareSimpleSearch(query: string): (value: string) => null | SearchResult {
213185
if (_prepareSimpleSearchMock.behavior) {
214186
return _prepareSimpleSearchMock.behavior(query);
215187
}
216-
return defaultPrepareSimpleSearch(query);
188+
return null;
217189
}

0 commit comments

Comments
 (0)