require_relative "test_helper"
class TestHighlight < Minitest::Unit::TestCase
def test_basic
store_names ["Two Door Cinema Club"]
assert_equal "Two Door Cinema Club", Product.search("cinema", fields: [:name], highlight: true).each_with_hit.first[1]["highlight"]["name.analyzed"].first
end
def test_tag
store_names ["Two Door Cinema Club"]
assert_equal "Two Door Cinema Club", Product.search("cinema", fields: [:name], highlight: {tag: ""}).each_with_hit.first[1]["highlight"]["name.analyzed"].first
end
def test_multiple_fields
store [{name: "Two Door Cinema Club", color: "Cinema Orange"}]
highlight = Product.search("cinema", fields: [:name, :color], highlight: true).each_with_hit.first[1]["highlight"]
assert_equal "Two Door Cinema Club", highlight["name.analyzed"].first
assert_equal "Cinema Orange", highlight["color.analyzed"].first
end
end