test: updated for country

This commit is contained in:
carla 2026-02-24 09:36:42 +01:00
parent 3891c33204
commit 9fc8c3b74a
6 changed files with 49 additions and 14 deletions

View file

@ -45,11 +45,11 @@ defmodule MvWeb.GlobalSettingsLiveConfigTest do
{:ok, view, _html} = live(conn, ~p"/admin/import")
# Generate CSV with 501 rows (exceeding custom limit of 500)
header = "first_name;last_name;email;street;postal_code;city\n"
header = "first_name;last_name;email;country;city;street;postal_code\n"
rows =
for i <- 1..501 do
"Row#{i};Last#{i};email#{i}@example.com;Street#{i};12345;City#{i}\n"
"Row#{i};Last#{i};email#{i}@example.com;Country#{i};City#{i};Street#{i};12345\n"
end
large_csv = header <> Enum.join(rows)

View file

@ -136,10 +136,10 @@ defmodule MvWeb.ImportLiveTest do
test "error list is capped and truncation message is shown", %{conn: conn} do
{:ok, view, _html} = live(conn, ~p"/admin/import")
header = "first_name;last_name;email;street;postal_code;city\n"
header = "first_name;last_name;email;country;city;street;postal_code\n"
invalid_rows =
for i <- 1..100, do: "Row#{i};Last#{i};;Street#{i};12345;City#{i}\n"
for i <- 1..100, do: "Row#{i};Last#{i};;Country#{i};City#{i};Street#{i};12345\n"
upload_csv_file(view, header <> Enum.join(invalid_rows), "large_invalid.csv")
submit_import(view)
@ -154,11 +154,11 @@ defmodule MvWeb.ImportLiveTest do
test "row limit is enforced (1001 rows rejected)", %{conn: conn} do
{:ok, view, _html} = live(conn, ~p"/admin/import")
header = "first_name;last_name;email;street;postal_code;city\n"
header = "first_name;last_name;email;country;city;street;postal_code\n"
rows =
for i <- 1..1001 do
"Row#{i};Last#{i};email#{i}@example.com;Street#{i};12345;City#{i}\n"
"Row#{i};Last#{i};email#{i}@example.com;Country#{i};City#{i};Street#{i};12345\n"
end
upload_csv_file(view, header <> Enum.join(rows), "too_many_rows.csv")