Let’s say I’ve got the function below in my app/lib/app_web/views/project_view.ex
def find_if_checked(nil, _, _), do: ""
def find_if_checked(map, type, key) do
with types when not is_nil(types) <- map[key],
true <- type in Map.keys(types) do
"checked"
else
_ ->
""
end
end
How do I test functions in view modules in general? Do I just mock the map with necessary fields and pass it to the function in the test, or do I prepare & use the real map/data structure for testing?