Sha256: 44394084e4cc99482b98f05a7b5f0cfea3ab3391cfe1db45e78c4ab850389f1e
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require 'test_helper' module Workarea module Search class Storefront class ProductBundleTest < TestCase def bundled_products @bundled_products ||= [ create_product(variants: [{ sku: 'SKU1' }]), create_product(variants: [{ sku: 'SKU2' }]), create_product(variants: [{ sku: 'SKU3' }]) ] end def product @product ||= Catalog::Product.new( product_ids: bundled_products.map(&:id) ) end def search_model @search_model ||= ProductBundle.new(product) end def test_skus assert_equal(3, search_model.skus.length) assert_includes(search_model.skus, 'SKU1') assert_includes(search_model.skus, 'SKU2') assert_includes(search_model.skus, 'SKU3') end def test_variant_count assert_equal(3, search_model.variant_count) end def test_bundled_products_handles_nonexistent_ids product.product_ids << 'foo' assert_equal(3, search_model.send(:bundled_products).size) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-product_bundles-1.0.1 | test/models/workarea/search/storefront/product_bundle_test.rb |
workarea-product_bundles-1.0.0 | test/models/workarea/search/storefront/product_bundle_test.rb |