mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
Merge branch 'main' into feat/goals-v2-architecture
This commit is contained in:
@@ -99,6 +99,13 @@ class AccountTest < ActiveSupport::TestCase
|
||||
assert_equal opening_date, opening_anchor.entry.date
|
||||
end
|
||||
|
||||
test "accountable display names expose singular and group contexts" do
|
||||
assert_equal "Investment", Investment.singular_display_name
|
||||
assert_equal "Investments", Investment.display_name
|
||||
assert_equal "Cash", Depository.singular_display_name
|
||||
assert_equal "Cash", Depository.display_name
|
||||
end
|
||||
|
||||
test "gets short/long subtype label" do
|
||||
investment = Investment.new(subtype: "hsa")
|
||||
account = @family.accounts.create!(
|
||||
|
||||
@@ -56,9 +56,9 @@ class BalanceSheetTest < ActiveSupport::TestCase
|
||||
asset_groups = BalanceSheet.new(@family).assets.account_groups
|
||||
|
||||
assert_equal 3, asset_groups.size
|
||||
assert_equal 1000 + 2000, asset_groups.find { |ag| ag.name == I18n.t("accounts.types.depository") }.total
|
||||
assert_equal 3000, asset_groups.find { |ag| ag.name == I18n.t("accounts.types.investment") }.total
|
||||
assert_equal 5000, asset_groups.find { |ag| ag.name == I18n.t("accounts.types.other_asset") }.total
|
||||
assert_equal 1000 + 2000, asset_groups.find { |ag| ag.name == Depository.display_name }.total
|
||||
assert_equal 3000, asset_groups.find { |ag| ag.name == Investment.display_name }.total
|
||||
assert_equal 5000, asset_groups.find { |ag| ag.name == OtherAsset.display_name }.total
|
||||
end
|
||||
|
||||
test "calculates liability group totals" do
|
||||
@@ -71,8 +71,8 @@ class BalanceSheetTest < ActiveSupport::TestCase
|
||||
liability_groups = BalanceSheet.new(@family).liabilities.account_groups
|
||||
|
||||
assert_equal 2, liability_groups.size
|
||||
assert_equal 1000 + 2000, liability_groups.find { |ag| ag.name == I18n.t("accounts.types.credit_card") }.total
|
||||
assert_equal 3000 + 5000, liability_groups.find { |ag| ag.name == I18n.t("accounts.types.other_liability") }.total
|
||||
assert_equal 1000 + 2000, liability_groups.find { |ag| ag.name == CreditCard.display_name }.total
|
||||
assert_equal 3000 + 5000, liability_groups.find { |ag| ag.name == OtherLiability.display_name }.total
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -105,7 +105,7 @@ class AccountsTest < ApplicationSystemTestCase
|
||||
end
|
||||
|
||||
def assert_account_created(accountable_type, &block)
|
||||
click_link Accountable.from_type(accountable_type).display_name.singularize
|
||||
click_link Accountable.from_type(accountable_type).singular_display_name
|
||||
click_link "Enter account balance" if accountable_type.in?(%w[Depository Investment Crypto Loan CreditCard])
|
||||
|
||||
account_name = "[system test] #{accountable_type} Account"
|
||||
@@ -164,6 +164,6 @@ class AccountsTest < ApplicationSystemTestCase
|
||||
end
|
||||
|
||||
def humanized_accountable(accountable_type)
|
||||
Accountable.from_type(accountable_type).display_name.singularize
|
||||
Accountable.from_type(accountable_type).singular_display_name
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user