1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

Plaid sync tests and multi-currency investment support (#1531)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Plaid sync tests and multi-currency investment support

* Fix system test

* Cleanup

* Remove data migration
This commit is contained in:
Zach Gollwitzer 2024-12-12 08:56:52 -05:00 committed by GitHub
parent b2a56aefc1
commit 800eb4c146
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 406 additions and 165 deletions

View file

@ -13,7 +13,7 @@ class Account::SyncerTest < ActiveSupport::TestCase
)
end
test "converts foreign account balances to family currency" do
test "converts foreign account balances and holdings to family currency" do
@account.family.update! currency: "USD"
@account.update! currency: "EUR"
@ -27,10 +27,19 @@ class Account::SyncerTest < ActiveSupport::TestCase
]
)
Account::HoldingCalculator.any_instance.expects(:calculate).returns(
[
Account::Holding.new(security: securities(:aapl), date: 1.day.ago.to_date, amount: 500, currency: "EUR"),
Account::Holding.new(security: securities(:aapl), date: Date.current, amount: 500, currency: "EUR")
]
)
Account::Syncer.new(@account).run
assert_equal [ 1000, 1000 ], @account.balances.where(currency: "EUR").chronological.map(&:balance)
assert_equal [ 1200, 2000 ], @account.balances.where(currency: "USD").chronological.map(&:balance)
assert_equal [ 500, 500 ], @account.holdings.where(currency: "EUR").chronological.map(&:amount)
assert_equal [ 600, 1000 ], @account.holdings.where(currency: "USD").chronological.map(&:amount)
end
test "purges stale balances and holdings" do