Skip to content

Commit

Permalink
finish update_crypto call
Browse files Browse the repository at this point in the history
  • Loading branch information
mmenanno committed Jan 27, 2024
1 parent 69fbc0c commit e90e3c7
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/cassettes/crypto/update_crypto_success.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions test/lunchmoney/crypto/crypto_calls_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,26 @@ class CryptoCallsTest < ActiveSupport::TestCase
assert_kind_of(LunchMoney::Error, error)
end
end

test "update_crypto returns a Crypto objects on success response" do
VCR.use_cassette("crypto/update_crypto_success") do
# TODO: Current cassette has balance_as_of, currency, and status fields manually added in as they were
# not returned in the response as expected. Once I know if this is a bug or not we can adjust accordingly.
ensure_correct_api_key
api_call = LunchMoney::CryptoCalls.new.update_crypto(7638, balance: "2.000000000000000000")

assert_kind_of(LunchMoney::Crypto, api_call)
end
end

test "update_crypto returns an array of Error objects on error response" do
response = mock_faraday_response(fake_general_error)
LunchMoney::CryptoCalls.any_instance.stubs(:put).returns(response)

api_call = LunchMoney::CryptoCalls.new.update_crypto(7638, balance: "1.000000000000000000")

T.unsafe(api_call).each do |error|
assert_kind_of(LunchMoney::Error, error)
end
end
end

0 comments on commit e90e3c7

Please sign in to comment.