Sha256: 83b1ed59920b5e5f55d273b502f1339acc202eba52440ffa6ca4f12b30f22ac8

Contents?: true

Size: 1.93 KB

Versions: 15

Compression:

Stored size: 1.93 KB

Contents

require_relative 'test_helper'

# Internal: The test for Plaid::Enrich.
class PlaidEnrichTest < PlaidTest
  def test_get
    sample_transactions_to_enrich = [
      Plaid::ClientProvidedTransaction.new({
        id: "1",
        description: "TST *JETTIES BAGELS",
        amount: 10.00,
        direction: Plaid::EnrichTransactionDirection::OUTFLOW,
        location: Plaid::ClientProvidedTransactionLocation.new({
          city: "Ipswich",
          region: "MA",
        }),
        iso_currency_code: "USD",
      }),
      Plaid::ClientProvidedTransaction.new({
        id: "2",
        description: "AMAZON.COM*MJ3LO9AN2",
        amount: 10.00,
        direction: Plaid::EnrichTransactionDirection::OUTFLOW,
        iso_currency_code: "USD",
      }),
      Plaid::ClientProvidedTransaction.new({
        id: "3",
        description: "GOOGLE *FRESHBOOKS",
        amount: 10.00,
        direction: Plaid::EnrichTransactionDirection::OUTFLOW,
        iso_currency_code: "USD",
      }),
      Plaid::ClientProvidedTransaction.new({
        id: "4",
        description: "EARNIN TRANSFER",
        amount: 100.00,
        direction: Plaid::EnrichTransactionDirection::INFLOW,
        iso_currency_code: "USD",
      })
    ]

    transactions_enrich_get_request = Plaid::TransactionsEnrichRequest.new

    transactions_enrich_get_request.account_type = "depository"
    transactions_enrich_get_request.transactions = sample_transactions_to_enrich

    response = client.transactions_enrich(transactions_enrich_get_request)
    assert_kind_of(Plaid::TransactionsEnrichResponse, response)

    refute_empty(response.enriched_transactions)
    assert_equal(sample_transactions_to_enrich.length, response.enriched_transactions.length)

    response.enriched_transactions.each do |item|
      assert_kind_of(Float, item.amount)
      refute_nil(item.description)
      refute_nil(item.direction)
      refute_nil(item.enrichments)
      refute_nil(item.id)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
plaid-34.0.0 test/test_enrich.rb
plaid-33.0.0 test/test_enrich.rb
plaid-32.0.0 test/test_enrich.rb
plaid-31.0.0 test/test_enrich.rb
plaid-30.0.0 test/test_enrich.rb
plaid-29.0.0 test/test_enrich.rb
plaid-27.0.0 test/test_enrich.rb
plaid-26.0.1 test/test_enrich.rb
plaid-26.0.0 test/test_enrich.rb
plaid-25.0.0 test/test_enrich.rb
plaid-24.4.0 test/test_enrich.rb
plaid-24.3.0 test/test_enrich.rb
plaid-24.2.0 test/test_enrich.rb
plaid-24.0.0 test/test_enrich.rb
plaid-23.0.0 test/test_enrich.rb