mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 21:44:56 +00:00
* 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
31 lines
938 B
Ruby
31 lines
938 B
Ruby
require "test_helper"
|
|
|
|
class AccountIbkrCreationTest < ActiveSupport::TestCase
|
|
fixtures :families, :ibkr_items, :ibkr_accounts
|
|
|
|
test "uses interactive brokers account id as part of the default name" do
|
|
ibkr_account = ibkr_accounts(:main_account)
|
|
|
|
account = Account.create_from_ibkr_account(ibkr_account)
|
|
|
|
assert_equal "Interactive Brokers (U1234567)", account.name
|
|
assert_equal "Investment", account.accountable_type
|
|
assert_equal "CHF", account.currency
|
|
end
|
|
|
|
test "falls back to provider name when ibkr account id is missing" do
|
|
family = families(:empty)
|
|
ibkr_item = ibkr_items(:empty_item)
|
|
ibkr_account = ibkr_item.ibkr_accounts.create!(
|
|
name: "Imported IBKR Account",
|
|
ibkr_account_id: nil,
|
|
currency: "USD"
|
|
)
|
|
|
|
account = Account.create_from_ibkr_account(ibkr_account)
|
|
|
|
assert_equal "Interactive Brokers", account.name
|
|
assert_equal family, account.family
|
|
end
|
|
end
|