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.rbindex 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::FinancialDataResetSTATUS_COUNT_KEYS = (COUNT_KEYS - %i[syncs]) + %i[plaid_items]# sortedPROVIDER_ITEM_ASSOCIATIONS = %i[+ akahu_itemsbinance_itemsbrex_itemscoinbase_items+ coinspot_itemscoinstats_itemsenable_banking_itemsfinancekit_items@@ -59,11 +61,15 @@ class Family::FinancialDataResetplaid_itemsquestrade_itemsredbark_items+ sharesight_itemssimplefin_itemssnaptrade_itemssophtron_items+ trade_republic_items+ trading212_itemstruelayer_itemsup_items+ wise_items].freezeResult = 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.rbindex 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::TestCaseendend+ 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" doaccount = @family.accounts.firstprovider_item = @family.plaid_items.first