Sha256: e6cbc81e590f0f91a278795a2e47bc41d409c643731a6b2df9c737bc1d472182

Contents?: true

Size: 727 Bytes

Versions: 62

Compression:

Stored size: 727 Bytes

Contents

require 'test_helper'

module Workarea
  class OrderMergeTest < TestCase
    def test_merge
      create_product(id: 'PROD', variants: [{ sku: 'SKU3' }])

      original = Order.new(
        items: [
          { product_id: 'PROD', sku: 'SKU1' },
          { product_id: 'PROD', sku: 'SKU2' }
        ]
      )

      other = Order.new(
        promo_codes: %w(PROMOCODE),
        items: [
          { product_id: 'PROD', sku: 'SKU2' },
          { product_id: 'PROD', sku: 'SKU3' }
        ]
      )

      OrderMerge.new(original).merge(other)

      assert_equal(3, original.items.count)
      assert_equal([1, 1, 1], original.items.map(&:quantity))
      assert_equal(%w(PROMOCODE), original.promo_codes)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/services/workarea/order_merge_test.rb
workarea-core-3.5.26 test/services/workarea/order_merge_test.rb
workarea-core-3.4.45 test/services/workarea/order_merge_test.rb
workarea-core-3.5.25 test/services/workarea/order_merge_test.rb
workarea-core-3.5.23 test/services/workarea/order_merge_test.rb
workarea-core-3.4.44 test/services/workarea/order_merge_test.rb
workarea-core-3.5.22 test/services/workarea/order_merge_test.rb
workarea-core-3.4.43 test/services/workarea/order_merge_test.rb
workarea-core-3.5.21 test/services/workarea/order_merge_test.rb
workarea-core-3.4.42 test/services/workarea/order_merge_test.rb
workarea-core-3.5.20 test/services/workarea/order_merge_test.rb
workarea-core-3.4.41 test/services/workarea/order_merge_test.rb
workarea-core-3.5.19 test/services/workarea/order_merge_test.rb
workarea-core-3.4.40 test/services/workarea/order_merge_test.rb
workarea-core-3.5.18 test/services/workarea/order_merge_test.rb
workarea-core-3.4.39 test/services/workarea/order_merge_test.rb
workarea-core-3.5.17 test/services/workarea/order_merge_test.rb
workarea-core-3.4.38 test/services/workarea/order_merge_test.rb
workarea-core-3.5.16 test/services/workarea/order_merge_test.rb
workarea-core-3.4.37 test/services/workarea/order_merge_test.rb