Files
sure/test/models/ibkr_item/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

27 lines
813 B
Ruby

require "test_helper"
class IbkrItem::SyncerTest < ActiveSupport::TestCase
fixtures :families, :ibkr_items
setup do
@ibkr_item = ibkr_items(:configured_item)
end
test "perform_sync records a single auth error when credentials are missing" do
@ibkr_item.update!(token: nil)
syncer = IbkrItem::Syncer.new(@ibkr_item)
sync = @ibkr_item.syncs.create!
error = assert_raises(Provider::IbkrFlex::ConfigurationError) do
syncer.perform_sync(sync)
end
assert_equal "IBKR credentials are missing.", error.message
assert_equal "requires_update", @ibkr_item.reload.status
stats = sync.reload.sync_stats
assert_equal 1, stats["total_errors"]
assert_equal [ { "message" => "IBKR credentials are missing.", "category" => "auth_error" } ], stats["errors"]
end
end