Sha256: bf05aea519a81c80c8c604444621405970196a6c6579c99f575c1f1e1c79e97f

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

require 'test_helper'

module Workarea
  module FlowIo
    class LineItemFormTest < TestCase
      include FlowFixtures

      def test_currency_conversion
        product = create_product
        order = create_order

        create_product_discount(product_ids: [product.id])
        order.add_item(
          sku: product.skus.first,
          product_id: product.id,
          quantity: 1
        )
        order.update!(experience: build_flow_io_experience_geo)

        Pricing.perform(order)

        item = LineItemForm.new(
          order_item: order.items.first,
          discounts: []
        )
        discounts = item.to_h[:discounts]

        assert_equal(11000, item.price.amount)
        assert_equal(order.experience.currency, item.price.currency)
        refute_empty(discounts.discounts)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 test/services/workarea/flow_io/line_item_form_test.rb