defmodule HeroiconsTest do use ExUnit.Case, async: true @icon """ """ @tag :tmp_dir test "generated function", %{tmp_dir: tmp_dir} do Path.join(tmp_dir, "academic_cap.svg") |> File.write(@icon) quote do defmodule TestIcons do @icon_dir unquote(Path.absname(tmp_dir)) @before_compile Heroicons end end |> Code.compile_quoted() assert TestIcons.academic_cap() == @icon assert TestIcons.academic_cap(class: "h-6 w-6 text-gray-500") =~ ~s(class="h-6 w-6 text-gray-500") end end