fix(import): collapse duplicate fee-type warnings into a bounded list
This commit is contained in:
parent
118b9f8d57
commit
45c9b81983
2 changed files with 60 additions and 1 deletions
|
|
@ -21,6 +21,65 @@ defmodule Mv.Membership.Import.ImportRunnerTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "merge_progress/4 warning accumulation" do
|
||||
test "deduplicates identical warnings across chunks instead of growing unbounded" do
|
||||
progress = %{
|
||||
inserted: 0,
|
||||
failed: 0,
|
||||
errors: [],
|
||||
warnings: ["Fee type 'Ghost' not found; using the default fee type."],
|
||||
status: :running,
|
||||
current_chunk: 0,
|
||||
total_chunks: 3
|
||||
}
|
||||
|
||||
chunk_result = %{
|
||||
inserted: 2,
|
||||
failed: 0,
|
||||
errors: [],
|
||||
errors_truncated?: false,
|
||||
warnings: [
|
||||
"Fee type 'Ghost' not found; using the default fee type.",
|
||||
"Fee type 'Ghost' not found; using the default fee type."
|
||||
]
|
||||
}
|
||||
|
||||
result = ImportRunner.merge_progress(progress, chunk_result, 0)
|
||||
|
||||
assert result.warnings == ["Fee type 'Ghost' not found; using the default fee type."]
|
||||
end
|
||||
|
||||
test "preserves distinct warnings while collapsing duplicates" do
|
||||
progress = %{
|
||||
inserted: 0,
|
||||
failed: 0,
|
||||
errors: [],
|
||||
warnings: ["Fee type 'A' not found; using the default fee type."],
|
||||
status: :running,
|
||||
current_chunk: 0,
|
||||
total_chunks: 2
|
||||
}
|
||||
|
||||
chunk_result = %{
|
||||
inserted: 1,
|
||||
failed: 0,
|
||||
errors: [],
|
||||
errors_truncated?: false,
|
||||
warnings: [
|
||||
"Fee type 'A' not found; using the default fee type.",
|
||||
"Fee type 'B' not found; using the default fee type."
|
||||
]
|
||||
}
|
||||
|
||||
result = ImportRunner.merge_progress(progress, chunk_result, 0)
|
||||
|
||||
assert result.warnings == [
|
||||
"Fee type 'A' not found; using the default fee type.",
|
||||
"Fee type 'B' not found; using the default fee type."
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
describe "read_file_entry/2" do
|
||||
test "returns {:ok, content} for a readable file" do
|
||||
path =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue