Sha256: beeface4e3b6c4e4f0c86bb855a9118c8f5f044e56f5b89b3956248ddff78415

Contents?: true

Size: 967 Bytes

Versions: 1

Compression:

Stored size: 967 Bytes

Contents

require 'test_helper'

module Workarea
  module FlowIo
    class FulfillmentCancellationFormTest < Workarea::TestCase
      setup :order

      def test_to_flow_model
        quantities = {
          "1" => 1
        }
        fulfillment_cancellation_form = FlowIo::FulfillmentCancellationForm.from(id: id, quantities: quantities)

        expectec_hash = {
          change_source: "fulfillment",
          reason: "consumer_requested",
          lines: [
            { item_number: "SKU1", line_number: nil, quantity: 1 }
          ]
        }

        assert_equal expectec_hash, fulfillment_cancellation_form.to_hash
      end

      private

      def id
        "1234"
      end

      def order
        @order ||= Workarea::Order.create!(
          id: id,
          items: [
            {
              id: "1",
              sku: "SKU1",
              quantity: 1,
              product_id: 1
            }
          ]
        )
      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/fulfillment_cancellation_form_test.rb