1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-31 02:59:39 +02:00

First sketch of budgeting module

This commit is contained in:
Zach Gollwitzer 2024-12-30 17:29:59 -05:00
parent 5d1a2937bb
commit 9a2a7b31d4
45 changed files with 342 additions and 84 deletions

View file

@ -0,0 +1,28 @@
require "test_helper"
class TransferMatcherTest < ActiveSupport::TestCase
include Account::EntriesTestHelper
setup do
@family = families(:dylan_family)
@matcher = TransferMatcher.new(@family)
end
test "matches entries with opposite amounts and different accounts within 4 days" do
entry1 = create_transaction(account: accounts(:depository), amount: 100, date: Date.current)
entry2 = create_transaction(account: accounts(:credit_card), amount: -100, date: 2.days.ago.to_date)
assert_difference "Account::Transfer.count", 1 do
@matcher.match!([ entry1, entry2 ])
end
end
test "doesn't match entries more than 4 days apart" do
entry1 = create_transaction(account: accounts(:depository), amount: 100, date: Date.current)
entry2 = create_transaction(account: accounts(:credit_card), amount: -100, date: Date.current + 5.days)
assert_no_difference "Account::Transfer.count" do
@matcher.match!([ entry1, entry2 ])
end
end
end