Sha256: 301fc2159f55e643b9ef496abcfe6281dcb21a3e91312c9925ede9127a2f0195
Contents?: true
Size: 1.28 KB
Versions: 5
Compression:
Stored size: 1.28 KB
Contents
require 'test_helper' module Workarea decorate Storefront::ContentBlocks::ProductInsightsViewModelTest, with: :nvy_theme do def test_falling_back create_product(id: 'foo') create_product(id: 'bar') create_product(id: 'baz') create_product(id: 'qux') create_product(id: 'thud') create_product(id: 'corge') create_hot_products( results: [ { product_id: 'bar' }, { product_id: 'baz' }, { product_id: 'foo' } ] ) block = Content::Block.new( type_id: 'product_insights', data: { type: 'Hot Products' } ) view_model = Storefront::ContentBlocks::ProductInsightsViewModel.new(block) expected_order = %w(bar baz foo corge thud qux) assert_equal(expected_order.first(Workarea.config.product_insights_count), view_model.products.map(&:id)) create_top_products( results: [ { product_id: 'bar' }, { product_id: 'qux' }, { product_id: 'thud' } ] ) view_model = Storefront::ContentBlocks::ProductInsightsViewModel.new(block) expected_order = %w(bar baz foo qux thud corge) assert_equal(expected_order.first(Workarea.config.product_insights_count), view_model.products.map(&:id)) end end end
Version data entries
5 entries across 5 versions & 1 rubygems