Sha256: 899c0bd1da864e80ef696e427d33d02aeb05fc7e0c97bcba7089fbd5ba3545a7

Contents?: true

Size: 948 Bytes

Versions: 62

Compression:

Stored size: 948 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    module ContentBlocks
      class CategorySummaryViewModelTest < Workarea::TestCase
        include TestCase::SearchIndexing

        def test_products
          products = Array.new(3) { |i| create_product(name: "Test Product #{i}") }
          category = create_category(
            product_ids: [
              products.third.id,
              products.first.id,
              products.second.id
            ]
          )

          BulkIndexProducts.perform_by_models(products)

          block = Content::Block.new(
            type_id: 'category_summary',
            data: { 'category' => category.id }
          )

          view_model = ContentBlocks::CategorySummaryViewModel.new(block)
          assert_equal(
            ['Test Product 2', 'Test Product 0', 'Test Product 1'],
            view_model.products.map(&:name)
          )
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.27 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.26 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.45 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.25 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.23 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.44 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.22 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.43 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.21 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.42 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.20 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.41 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.19 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.40 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.18 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.39 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.17 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.38 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.16 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.37 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb