1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00
Maybe/test/models/family_test.rb
Zach Gollwitzer 8648f11413
Sync hierarchy updates (#2087)
* Add parent sync orchestration

* Pass sync object to dependents
2025-04-11 12:13:46 -04:00

29 lines
782 B
Ruby

require "test_helper"
require "csv"
class FamilyTest < ActiveSupport::TestCase
include Account::EntriesTestHelper
include SyncableInterfaceTest
def setup
@family = families(:empty)
@syncable = families(:dylan_family)
end
test "syncs plaid items and manual accounts" do
family_sync = syncs(:family)
manual_accounts_count = @syncable.accounts.manual.count
items_count = @syncable.plaid_items.count
Account.any_instance.expects(:sync_later)
.with(start_date: nil, parent_sync: family_sync)
.times(manual_accounts_count)
PlaidItem.any_instance.expects(:sync_later)
.with(start_date: nil, parent_sync: family_sync)
.times(items_count)
@syncable.sync_data(family_sync, start_date: family_sync.start_date)
end
end