Sha256: b28bfe90791fc28b8746f9ede0f9586922a375208b8f47cee3eb4c6d5bdcef70

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require "test_helper"

module Workarea
  module Storefront
    class ContentBlocks::TaxonomyWithProductsViewModelTest < Workarea::SystemTest
      def test_locals_returns_additional_local_data_keys
        taxon = create_taxon

        content = create_content
        block = content.blocks.create!(
          area: "body",
          type_id: "taxonomy_with_products",
          data: {
            start: taxon.id.to_s,
            products: [
              create_product(name: "Test Product 1").id,
              create_product(name: "Test Product 2").id
            ]
          }
        )

        view_model = Storefront::ContentBlocks::TaxonomyWithProductsViewModel.new(block)
        assert_equal(taxon, view_model.starting_taxon)
        assert_equal(view_model.products.map(&:name), ["Test Product 1", "Test Product 2"])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-one_theme-1.3.1 test/view_models/workarea/storefront/taxonomy_with_products_view_model_test.rb
workarea-one_theme-1.3.0 test/view_models/workarea/storefront/taxonomy_with_products_view_model_test.rb