defmodule MicrowavepropWeb.AboutLiveTest do use MicrowavepropWeb.ConnCase, async: true import Phoenix.LiveViewTest alias Microwaveprop.Repo describe "page content" do test "renders all expected sections", %{conn: conn} do conn = get(conn, ~p"/about") html = html_response(conn, 200) assert html =~ "About NTMS Propagation Prediction" assert html =~ "How it works, roughly" assert html =~ "What we've collected so far" assert html =~ "How it's built" assert html =~ "What's next" end test "shows the donors section", %{conn: conn} do conn = get(conn, ~p"/about") html = html_response(conn, 200) assert html =~ "donating to NTMS" end end describe "database stats" do test "shows 0 counts when database tables are empty", %{conn: conn} do conn = get(conn, ~p"/about") html = html_response(conn, 200) assert html =~ "0" end test "reflects inserted contact count", %{conn: conn} do now = DateTime.utc_now() id = Ecto.UUID.dump!(Ecto.UUID.generate()) Repo.query!( "INSERT INTO contacts (id, station1, station2, qso_timestamp, band, inserted_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6, $6)", [id, "K1ABC", "K2XYZ", now, Decimal.new("1.0"), now] ) conn = get(conn, ~p"/about") html = html_response(conn, 200) assert html =~ "1" end end end