Sha256: d48e33bc8c8a8d58aca61d66972025efd001e485bec39dd228b6c9d3ec4d4ba8

Contents?: true

Size: 973 Bytes

Versions: 34

Compression:

Stored size: 973 Bytes

Contents

require 'test_helper'

module Workarea
  module Recommendation
    class UserActivityBasedTest < IntegrationTest
      setup :create_products

      def create_products
        @one = create_product(id: '1')
        @two = create_product(id: '2')
        @three = create_product(id: '3')

        create_top_products(
          results: [
            { 'product_id' => '1' },
            { 'product_id' => '2' },
            { 'product_id' => '3' }
          ]
        )
      end

      def test_using_popular_products_if_blank
        activity = UserActivity.new
        query = UserActivityBased.new(activity)
        assert_equal(%w(1 2 3), query.results)
      end

      def test_using_related_products
        activity = UserActivity.new(product_ids: %w(1))
        query = UserActivityBased.new(activity)
        assert_equal(2, query.results.size)
        assert_includes(query.results, '2')
        assert_includes(query.results, '3')
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

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