Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Reset provider connections for every syncable provider (#4923)

Molly1746ff912e8e
diff --git a/app/models/family/financial_data_reset.rb b/app/models/family/financial_data_reset.rb
index 7702359c34..9a811734bc 100644
--- a/app/models/family/financial_data_reset.rb
+++ b/app/models/family/financial_data_reset.rb
@@ -42,9 +42,11 @@ class Family::FinancialDataReset
STATUS_COUNT_KEYS = (COUNT_KEYS - %i[syncs]) + %i[plaid_items]
# sorted
PROVIDER_ITEM_ASSOCIATIONS = %i[
+ akahu_items
binance_items
brex_items
coinbase_items
+ coinspot_items
coinstats_items
enable_banking_items
financekit_items
@@ -59,11 +61,15 @@ class Family::FinancialDataReset
plaid_items
questrade_items
redbark_items
+ sharesight_items
simplefin_items
snaptrade_items
sophtron_items
+ trade_republic_items
+ trading212_items
truelayer_items
up_items
+ wise_items
].freeze
Result = Struct.new(:user, :family, :dry_run, :before_counts, :deleted_counts, :after_counts, keyword_init: true)
diff --git a/test/models/family/financial_data_reset_test.rb b/test/models/family/financial_data_reset_test.rb
index 650542482f..e0031bdbd0 100644
--- a/test/models/family/financial_data_reset_test.rb
+++ b/test/models/family/financial_data_reset_test.rb
@@ -40,6 +40,12 @@ class Family::FinancialDataResetTest < ActiveSupport::TestCase
end
end
+ test "provider item associations cover every syncable family association" do
+ missing = Family::Syncer.syncable_item_associations - Family::FinancialDataReset.provider_item_associations
+
+ assert_empty missing, "reset leaves provider connections behind: #{missing.join(', ')}"
+ end
+
test "sync counts use the family sync scope without double counting" do
account = @family.accounts.first
provider_item = @family.plaid_items.first