Sha256: cbd3c970c2a9073389cfd75a2a8a575395d8eec3a9eceb33714f27db8d07176b

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

require "test_helper"

module Workarea
  module Listrak
    module Analytics
      class HelperTest < Workarea::ViewTest
        include Workarea::ApplicationHelper
        include Workarea::Storefront::AnalyticsHelper
        include TestCase::SearchIndexing

        setup do
          @order = Storefront::OrderViewModel.wrap create_placed_order
          @item = @order.items.first
          @product = Catalog::Product.find @item.product_id
        end

        def test_order_analytics_data_extensions
          unless @order.user_id.nil?
            assert_equal @order.user_id, order_analytics_data(@order)[:user_id]
          end
          assert_equal @order.email, order_analytics_data(@order)[:email]
          assert_equal @order.subtotal_price.to_f, order_analytics_data(@order)[:subtotal_price]
          assert_equal @order.shipping_address.first_name, order_analytics_data(@order)[:first_name]
          assert_equal @order.shipping_address.last_name, order_analytics_data(@order)[:last_name]
        end

        def test_cart_view_analytics_data_extensions
          assert_equal @order.token, cart_view_analytics_data(@order)[:payload][:token]
        end

        def test_order_item_analytics_data_extensions
          assert_match %r{/product_images/placeholder}, order_item_analytics_data(@item)[:image_url]
          assert_equal @item.product.to_param, order_item_analytics_data(@item)[:slug]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
workarea-listrak-5.0.4 test/helpers/workarea/listrak/analytics/helper_test.rb
workarea-listrak-5.0.3 test/helpers/workarea/listrak/analytics/helper_test.rb
workarea-listrak-5.0.2 test/helpers/workarea/listrak/analytics/helper_test.rb
workarea-listrak-5.0.1 test/helpers/workarea/listrak/analytics/helper_test.rb