mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Calculates balance based on previous transaction on the same date (#1483)
This commit is contained in:
parent
6996a225ba
commit
242eb5cea1
2 changed files with 20 additions and 1 deletions
|
@ -110,4 +110,15 @@ class Account::EntryTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal Money.new(100), transaction.balance_after_entry
|
||||
end
|
||||
|
||||
test "prior_entry_balance returns last transaction entry balance" do
|
||||
family = families(:empty)
|
||||
account = family.accounts.create! name: "Test", balance: 0, currency: "USD", accountable: Depository.new
|
||||
|
||||
new_valuation = create_valuation(account: account, amount: 1)
|
||||
transaction = create_transaction(date: new_valuation.date, account: account, amount: -100)
|
||||
|
||||
|
||||
assert_equal Money.new(100), transaction.prior_entry_balance
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue