Add regression test for command preview corpus

This commit is contained in:
Lawrence Chen 2026-03-06 04:28:18 -08:00
parent 23910dea9a
commit fdf2212c88
2 changed files with 55 additions and 0 deletions

View file

@ -3434,6 +3434,25 @@ struct ContentView: View {
return Array(matches.prefix(resultLimit))
}
nonisolated static func commandPaletteCommandPreviewMatchCommandIDsForTests(
searchCorpus: [CommandPaletteSearchCorpusEntry<String>],
candidateCommandIDs: [String],
searchCorpusByID: [String: CommandPaletteSearchCorpusEntry<String>],
query: String,
resultLimit: Int
) -> [String] {
let preparedQuery = CommandPaletteFuzzyMatcher.preparedQuery(query)
return commandPalettePreviewSearchMatches(
candidateCommandIDs: candidateCommandIDs,
searchCorpusByID: searchCorpusByID,
query: query,
usageHistory: [:],
queryIsEmpty: preparedQuery.isEmpty,
historyTimestamp: 0,
resultLimit: resultLimit
).map(\.commandID)
}
private func scheduleCommandPaletteResultsRefresh(forceSearchCorpusRefresh: Bool = false) {
refreshCommandPaletteSearchCorpus(force: forceSearchCorpusRefresh)