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.4.27 test/services/workarea/order_merge_test.rb
workarea-core-3.5.4 test/services/workarea/order_merge_test.rb
workarea-core-3.4.26 test/services/workarea/order_merge_test.rb
workarea-core-3.5.3 test/services/workarea/order_merge_test.rb
workarea-core-3.4.25 test/services/workarea/order_merge_test.rb
workarea-core-3.5.2 test/services/workarea/order_merge_test.rb
workarea-core-3.4.24 test/services/workarea/order_merge_test.rb
workarea-core-3.5.1 test/services/workarea/order_merge_test.rb
workarea-core-3.4.23 test/services/workarea/order_merge_test.rb
workarea-core-3.4.22 test/services/workarea/order_merge_test.rb
workarea-core-3.5.0 test/services/workarea/order_merge_test.rb
workarea-core-3.4.21 test/services/workarea/order_merge_test.rb
workarea-core-3.5.0.beta.1 test/services/workarea/order_merge_test.rb
workarea-core-3.4.20 test/services/workarea/order_merge_test.rb
workarea-core-3.4.19 test/services/workarea/order_merge_test.rb
workarea-core-3.4.18 test/services/workarea/order_merge_test.rb
workarea-core-3.4.17 test/services/workarea/order_merge_test.rb
workarea-core-3.4.16 test/services/workarea/order_merge_test.rb
workarea-core-3.4.15 test/services/workarea/order_merge_test.rb
workarea-core-3.4.14 test/services/workarea/order_merge_test.rb