refactor: reduce complexity

This commit is contained in:
carla 2026-01-15 17:00:17 +01:00
parent 67072f0c52
commit 6dc398fa5a
3 changed files with 92 additions and 78 deletions

View file

@ -72,7 +72,7 @@ defmodule Mv.Membership.Import.MemberCSVTest do
end
end
describe "process_chunk/3" do
describe "process_chunk/4" do
test "function exists and accepts chunk_rows_with_lines, column_map, custom_field_map, and opts" do
chunk_rows_with_lines = [{2, %{member: %{email: "john@example.com"}, custom: %{}}}]
column_map = %{email: 0}
@ -173,7 +173,12 @@ defmodule Mv.Membership.Import.MemberCSVTest do
column_map = %{email: 0}
custom_field_map = %{to_string(custom_field.id) => 1}
opts = []
custom_field_lookup = %{
to_string(custom_field.id) => %{id: custom_field.id, value_type: custom_field.value_type}
}
opts = [custom_field_lookup: custom_field_lookup]
assert {:ok, chunk_result} =
MemberCSV.process_chunk(chunk_rows_with_lines, column_map, custom_field_map, opts)