Sha256: 8fa15f854ffdf2770993c1a82254f0d1055f447724a03521903f836212c4355b

Contents?: true

Size: 983 Bytes

Versions: 28

Compression:

Stored size: 983 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
        metrics = Metrics::User.new
        query = UserActivityBased.new(metrics)
        assert_equal(%w(1 2 3), query.results)
      end

      def test_using_related_products
        metrics = Metrics::User.new(viewed: { product_ids: %w(1) })
        query = UserActivityBased.new(metrics)
        assert_equal(2, query.results.size)
        assert_includes(query.results, '2')
        assert_includes(query.results, '3')
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.26 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.25 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.23 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.22 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.21 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.20 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.19 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.18 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.17 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.16 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.15 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.14 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.13 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.12 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.11 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.10 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.9 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.8 test/queries/workarea/recommendation/user_activity_based_test.rb
workarea-core-3.5.7 test/queries/workarea/recommendation/user_activity_based_test.rb