Files
sure/test/models/account/syncer_test.rb
Gian-Reto Tarnutzer ce5d7dd736 Add Interactive Brokers Provider (#1722)
* Display multi-currency holdings correctly

* Implement IBKR provider

* Fix: Use historical exchange rate for historical prices

* Add brokerage exchange rate for trades

* Sync historical balances from IBKR

* Add logos in activity history

* Fix privacy mode blur in account view

* Improve IBKR XML Flex report parser errors
2026-05-12 23:45:19 +02:00

32 lines
993 B
Ruby

require "test_helper"
require "ostruct"
class Account::SyncerTest < ActiveSupport::TestCase
test "applies IBKR historical balance overrides after materialization" do
family = families(:empty)
account = family.accounts.create!(
name: "IBKR Brokerage",
balance: 0,
cash_balance: 0,
currency: "CHF",
accountable: Investment.new(subtype: "brokerage")
)
ibkr_account = family.ibkr_items.create!(
name: "IBKR",
query_id: "QUERY123",
token: "TOKEN123"
).ibkr_accounts.create!(
name: "Main",
ibkr_account_id: "U1234567",
currency: "CHF"
)
ibkr_account.ensure_account_provider!(account)
Account::MarketDataImporter.any_instance.expects(:import_all).once
Balance::Materializer.any_instance.expects(:materialize_balances).once
IbkrAccount::HistoricalBalancesSync.any_instance.expects(:sync!).once
Account::Syncer.new(account).perform_sync(OpenStruct.new(window_start_date: nil))
end
end