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.15 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.36 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.14 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.35 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.13 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.34 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.12 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.33 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.11 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.10 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.32 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.9 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.31 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.8 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.30 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.7 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.29 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.6 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.4.28 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb
workarea-storefront-3.5.5 test/view_models/workarea/storefront/content_blocks/category_summary_view_model_test.rb