1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00
Maybe/test/models/family/syncer_test.rb

31 lines
747 B
Ruby
Raw Normal View History

require "test_helper"
class Family::SyncerTest < ActiveSupport::TestCase
setup do
@family = families(:dylan_family)
end
test "syncs plaid items and manual accounts" do
family_sync = syncs(:family)
manual_accounts_count = @family.accounts.manual.count
items_count = @family.plaid_items.count
syncer = Family::Syncer.new(@family)
Account.any_instance
.expects(:sync_later)
2025-05-26 05:39:14 -04:00
.with(parent_sync: family_sync)
.times(manual_accounts_count)
PlaidItem.any_instance
.expects(:sync_later)
2025-05-26 05:39:14 -04:00
.with(parent_sync: family_sync)
.times(items_count)
syncer.perform_sync(family_sync)
assert_equal "completed", family_sync.reload.status
end
end