Sha256: 2997371c1d874d0d3b8a5426038b6b2aeae5758d250f3c16ca3ea9d0932492a0

Contents?: true

Size: 928 Bytes

Versions: 34

Compression:

Stored size: 928 Bytes

Contents

require 'test_helper'

module Workarea
  module Search
    class SearchSuggestionsTest < TestCase
      include SearchIndexing

      def test_results
        Metrics::SearchByDay.save_search('test', 1)
        2.times { Metrics::SearchByDay.save_search('test product', 2) }
        travel_to 1.week.from_now
        GenerateInsights.generate_all!
        BulkIndexSearches.perform

        create_product(name: 'test product 1')
        create_product(name: 'test product 2', active: false)
        BulkIndexProducts.perform

        results = SearchSuggestions.new(q: 'tes').results

        assert_equal(3, results.length)

        refute_nil(results.detect { |r| r['_source']['content']['name'] == 'test product' })
        refute_nil(results.detect { |r| r['_source']['content']['name'] == 'test' })
        refute_nil(results.detect { |r| r['_source']['content']['name'] == 'test product 1' })
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.45 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.44 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.43 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.42 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.41 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.40 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.39 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.38 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.37 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.36 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.35 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.34 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.33 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.32 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.31 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.30 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.29 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.28 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.27 test/queries/workarea/search/search_suggestions_test.rb
workarea-core-3.4.26 test/queries/workarea/search/search_suggestions_test.rb