Sha256: 46642325e1284f81e7da210ee04cdd1c9e771c05f1e2ac3ac73dec627057b8e8

Contents?: true

Size: 1.79 KB

Versions: 14

Compression:

Stored size: 1.79 KB

Contents

require_relative "test_helper"

class SynonymsTest < Minitest::Test
  def test_bleach
    store_names ["Clorox Bleach", "Kroger Bleach"]
    assert_search "clorox", ["Clorox Bleach", "Kroger Bleach"]
  end

  def test_saran_wrap
    store_names ["Saran Wrap", "Kroger Plastic Wrap"]
    assert_search "saran wrap", ["Saran Wrap", "Kroger Plastic Wrap"]
  end

  def test_burger_buns
    store_names ["Hamburger Buns"]
    assert_search "burger buns", ["Hamburger Buns"]
  end

  def test_bandaids
    store_names ["Band-Aid", "Kroger 12-Pack Bandages"]
    assert_search "bandaids", ["Band-Aid", "Kroger 12-Pack Bandages"]
  end

  def test_qtips
    store_names ["Q Tips", "Kroger Cotton Swabs"]
    assert_search "q tips", ["Q Tips", "Kroger Cotton Swabs"]
  end

  def test_reverse
    store_names ["Scallions"]
    assert_search "green onions", ["Scallions"]
  end

  def test_exact
    store_names ["Green Onions", "Yellow Onions"]
    assert_search "scallion", ["Green Onions"]
  end

  def test_stemmed
    store_names ["Green Onions", "Yellow Onions"]
    assert_search "scallions", ["Green Onions"]
  end

  def test_word_start
    store_names ["Clorox Bleach", "Kroger Bleach"]
    assert_search "clorox", ["Clorox Bleach", "Kroger Bleach"], fields: [{name: :word_start}]
  end

  def test_wordnet
    skip unless ENV["TEST_WORDNET"]
    store_names ["Creature", "Beast", "Dragon"], Animal
    assert_search "animal", ["Creature", "Beast"], {}, Animal
  end

  def test_directional
    store_names ["Lightbulb", "Green Onions", "Led"]
    assert_search "led", ["Lightbulb", "Led"]
    assert_search "Lightbulb", ["Lightbulb"]
    assert_search "Halogen Lamp", ["Lightbulb"]
    assert_search "onions", ["Green Onions"]
  end

  def test_case
    store_names ["Uppercase"]
    assert_search "lowercase", ["Uppercase"]
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
searchkick-3.0.0 test/synonyms_test.rb
searchkick-2.5.0 test/synonyms_test.rb
searchkick-hooopo-2.4.1 test/synonyms_test.rb
searchkick-hooopo-2.4.0 test/synonyms_test.rb
searchkick-2.4.0 test/synonyms_test.rb
searchkick-hooopo-2.3.5 test/synonyms_test.rb
searchkick-2.3.2 test/synonyms_test.rb
searchkick-hooopo-2.3.4 test/synonyms_test.rb
searchkick-2.3.1 test/synonyms_test.rb
searchkick-hooopo-2.3.3 test/synonyms_test.rb
searchkick-hooopo-2.3.2 test/synonyms_test.rb
searchkick-hooopo-2.3.1 test/synonyms_test.rb
searchkick-hooopo-2.3.0 test/synonyms_test.rb
searchkick-2.3.0 test/synonyms_test.rb