defmodule MicrowavepropWeb.AlgoLiveTest do
  use MicrowavepropWeb.ConnCase, async: true

  import Phoenix.LiveViewTest

  describe "mount" do
    test "renders algo page with markdown content as HTML", %{conn: conn} do
      {:ok, _lv, html} = live(conn, ~p"/algo")

      # algo.md starts with this heading
      assert html =~ "Microwave Propagation Algorithm"
      # Earmark should convert ## headings to h2 tags
      assert html =~ "<h2>"
      # Should contain code blocks rendered as HTML
      assert html =~ "<code"
    end

    test "sets page title", %{conn: conn} do
      {:ok, _lv, html} = live(conn, ~p"/algo")
      assert html =~ "Algorithm"
    end
  end
end
