mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Preserve original transaction names when enriching (#1556)
* Preserve original transaction name * Remove stale method * Fix tests
This commit is contained in:
parent
68617514b0
commit
7be6a372bf
22 changed files with 100 additions and 76 deletions
|
@ -76,7 +76,7 @@ module AccountableResourceInterfaceTest
|
|||
end
|
||||
|
||||
test "updates account balance by editing existing valuation for today" do
|
||||
@account.entries.create! date: Date.current, amount: 6000, currency: "USD", entryable: Account::Valuation.new
|
||||
@account.entries.create! date: Date.current, amount: 6000, currency: "USD", name: "Balance update", entryable: Account::Valuation.new
|
||||
|
||||
assert_no_difference [ "Account::Entry.count", "Account::Valuation.count" ] do
|
||||
patch account_url(@account), params: {
|
||||
|
|
|
@ -90,10 +90,4 @@ class Account::EntryTest < ActiveSupport::TestCase
|
|||
|
||||
assert_equal Money.new(-200), family.entries.income_total("USD")
|
||||
end
|
||||
|
||||
# See: https://github.com/maybe-finance/maybe/wiki/vision#signage-of-money
|
||||
test "transactions with negative amounts are inflows, positive amounts are outflows to an account" do
|
||||
assert create_transaction(amount: -10).inflow?
|
||||
assert create_transaction(amount: 10).outflow?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ class TradesTest < ApplicationSystemTestCase
|
|||
end
|
||||
|
||||
test "can create buy transaction" do
|
||||
shares_qty = 25.0
|
||||
shares_qty = 25
|
||||
|
||||
open_new_trade_modal
|
||||
|
||||
|
@ -38,7 +38,7 @@ class TradesTest < ApplicationSystemTestCase
|
|||
visit_account_trades
|
||||
|
||||
within_trades do
|
||||
assert_text "Buy 10.0 shares of AAPL"
|
||||
assert_text "Purchase 10 shares of AAPL"
|
||||
assert_text "Buy #{shares_qty} shares of AAPL"
|
||||
end
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ class TradesTest < ApplicationSystemTestCase
|
|||
visit_account_trades
|
||||
|
||||
within_trades do
|
||||
assert_text "Sell #{aapl.qty} shares of AAPL"
|
||||
assert_text "Sell #{aapl.qty.round} shares of AAPL"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue