Hi all, I’m trying to test my controller but I get an error regarding maps inside lists. This is an example:
test "create classifier", %{conn: conn} do
classifier = %{
classifier: %{
threshold: 15,
perks: [
%{points: 10, description: "desc_1"},
%{points: 12, description: "desc_2"}
]
}
}
conn = post(conn, Routes.classifier_path(conn, :create, classifier))
assert json_response(conn, 200)["data"] == %{
"threshold" => 15
}
end
However, I get this error (ArgumentError) cannot encode maps inside lists when the map has 0 or more than 1 element, got: %{points: 10, description: "test_desc"}
How can I test this endpoint?