Add tests for hyphenated string search
Cover the stemmer tokenizing hyphenated input into separate words and end-to-end search finding cards with hyphenated titles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,4 +12,10 @@ class Search::StemmerTest < ActiveSupport::TestCase
|
||||
|
||||
assert_equal "test run jump walk", result
|
||||
end
|
||||
|
||||
test "stem hyphenated words" do
|
||||
result = Search::Stemmer.stem("BC3-IOS-1D8B")
|
||||
|
||||
assert_equal "bc3 io 1d8b", result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,4 +35,11 @@ class SearchTest < ActiveSupport::TestCase
|
||||
results = Search::Record.for(user_without_access.account_id).search("anything", user: user_without_access)
|
||||
assert_empty results
|
||||
end
|
||||
|
||||
test "search for hyphenated strings" do
|
||||
card = @board.cards.create!(title: "BC3-IOS-1D8B", creator: @user, status: "published")
|
||||
|
||||
results = Search::Record.for(@user.account_id).search("BC3-IOS-1D8B", user: @user)
|
||||
assert results.find { |it| it.card_id == card.id }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user