feat(overview): add point-in-time, suspended, OR-group and count-range filters
This commit is contained in:
parent
c547ca19af
commit
c0d1550401
23 changed files with 1116 additions and 117 deletions
|
|
@ -40,6 +40,43 @@ defmodule MvWeb.MemberLive.IndexPaymentPeriodTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "period short code (§1.28)" do
|
||||
test "the all-outstanding default has no short code" do
|
||||
assert PaymentAging.period_short_code(%{from: nil, to: nil}) == nil
|
||||
end
|
||||
|
||||
test "a full calendar year renders as the year" do
|
||||
assert PaymentAging.period_short_code(%{from: ~D[2026-01-01], to: ~D[2026-12-31]}) == "2026"
|
||||
end
|
||||
|
||||
test "a full calendar quarter renders as Q# YYYY" do
|
||||
assert PaymentAging.period_short_code(%{from: ~D[2026-01-01], to: ~D[2026-03-31]}) ==
|
||||
"Q1 2026"
|
||||
|
||||
assert PaymentAging.period_short_code(%{from: ~D[2026-10-01], to: ~D[2026-12-31]}) ==
|
||||
"Q4 2026"
|
||||
end
|
||||
|
||||
test "an arbitrary bounded period has no compact short code" do
|
||||
assert PaymentAging.period_short_code(%{from: ~D[2026-02-03], to: ~D[2026-08-17]}) == nil
|
||||
# An open-ended period is not compactly codeable either.
|
||||
assert PaymentAging.period_short_code(%{from: ~D[2026-01-01], to: nil}) == nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "period tooltip (§1.28)" do
|
||||
test "names the period with locally formatted bounds" do
|
||||
tip = PaymentAging.period_tooltip(%{from: ~D[2026-01-01], to: ~D[2026-12-31]})
|
||||
assert tip =~ "01.01.2026"
|
||||
assert tip =~ "31.12.2026"
|
||||
end
|
||||
|
||||
test "the all-outstanding default reads as all outstanding" do
|
||||
tip = PaymentAging.period_tooltip(%{from: nil, to: nil})
|
||||
assert is_binary(tip) and tip =~ "outstanding"
|
||||
end
|
||||
end
|
||||
|
||||
describe "payment-count filter codec" do
|
||||
test "round-trips fully_paid and has-unpaid thresholds" do
|
||||
for state <- [:fully_paid, {:has_unpaid, 1}, {:has_unpaid, 2}, {:has_unpaid, 3}] do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue