fix: improve get_last_completed_cycle and fix test helpers
- Fix get_last_completed_cycle to find most recent completed cycle - Fix create_cycle helpers to delete auto-generated cycles first - Fix Ash.destroy return value handling - Fix form selectors to use specific IDs - Fix URL parameter names for filters - Fix Ash.read_one return value expectations in tests
This commit is contained in:
parent
ab7fa38010
commit
128c712dbc
12 changed files with 177 additions and 43 deletions
|
|
@ -58,6 +58,14 @@ defmodule MvWeb.MemberLive.ShowMembershipFeesTest do
|
|||
|
||||
# Helper to create a cycle
|
||||
defp create_cycle(member, fee_type, attrs) do
|
||||
# Delete any auto-generated cycles first to avoid conflicts
|
||||
existing_cycles =
|
||||
MembershipFeeCycle
|
||||
|> Ash.Query.filter(member_id == ^member.id)
|
||||
|> Ash.read!()
|
||||
|
||||
Enum.each(existing_cycles, fn cycle -> Ash.destroy!(cycle) end)
|
||||
|
||||
default_attrs = %{
|
||||
cycle_start: ~D[2023-01-01],
|
||||
amount: Decimal.new("50.00"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue