1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00
Maybe/test/controllers/concerns/auto_sync_test.rb
Josh Pigford a76cc2dff8
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled
Configure PlaidSandbox to use sandbox environment regardless of Rails config and set test environment variables for Plaid. Temporarily disable AutoSync functionality in tests.
2025-06-01 06:37:46 -05:00

51 lines
1.3 KiB
Ruby

require "test_helper"
class AutoSyncTest < ActionDispatch::IntegrationTest
setup do
sign_in @user = users(:family_admin)
@family = @user.family
# Start fresh
Sync.destroy_all
end
test "auto-syncs family if hasn't synced" do
skip "AutoSync functionality temporarily disabled"
assert_difference "Sync.count", 1 do
get root_path
end
end
test "auto-syncs family if hasn't synced in last 24 hours" do
skip "AutoSync functionality temporarily disabled"
# If request comes in at beginning of day, but last sync was 1 hour ago ("yesterday"), we still sync
travel_to Time.current.beginning_of_day
last_sync_datetime = 1.hour.ago
Sync.create!(syncable: @family, created_at: last_sync_datetime, status: "completed")
assert_difference "Sync.count", 1 do
get root_path
end
end
test "does not auto-sync if family has synced today already" do
travel_to Time.current.end_of_day
last_created_sync_at = 23.hours.ago
Sync.create!(syncable: @family, created_at: last_created_sync_at, status: "completed")
assert_no_difference "Sync.count" do
get root_path
end
end
test "does not auto-sync if preference is disabled" do
@family.update!(auto_sync_on_login: false)
assert_no_difference "Sync.count" do
get root_path
end
end
end