1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 05:25:24 +02:00

Transaction transfers, payments, and matching (#883)

* Add transfer model and clean up family snapshot fixtures

* Ignore transfers in income and expense snapshots

* Add transfer validations

* Implement basic transfer matching UI

* Fix merge conflicts

* Add missing translations

* Tweak selection states for transfer types

* Add missing i18n translation
This commit is contained in:
Zach Gollwitzer 2024-06-19 06:52:08 -04:00 committed by GitHub
parent b462bc8f8c
commit ca39b26070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
57 changed files with 991 additions and 427 deletions

View file

@ -3,6 +3,7 @@ require "test_helper"
class TransactionTest < ActiveSupport::TestCase
setup do
@transaction = transactions(:checking_one)
@family = families(:dylan_family)
end
# See: https://github.com/maybe-finance/maybe/wiki/vision#signage-of-money
@ -41,4 +42,14 @@ class TransactionTest < ActiveSupport::TestCase
current_transaction.account.expects(:sync_later).with(prior_transaction.date)
current_transaction.sync_account_later
end
test "can calculate total spending for a group of transactions" do
assert_equal Money.new(2135), @family.transactions.expense_total("USD")
assert_equal Money.new(1010.85, "EUR"), @family.transactions.expense_total("EUR")
end
test "can calculate total income for a group of transactions" do
assert_equal -Money.new(2075), @family.transactions.income_total("USD")
assert_equal -Money.new(250, "EUR"), @family.transactions.income_total("EUR")
end
end