prop/test/microwaveprop_web/live/about_live_test.exs
Graham McIntire c722a77dcd
Add test coverage for Mailer and AboutLive
- Mailer: apply_defaults/1 sets From and Reply-To headers
- AboutLive: content rendering, empty stats, and contact count display
- Fix has_many :beacons association (wrong module path)
- Fix router pipeline order: serve_markdown before accepts,
  after secure headers so markdown responses get security headers
- Fix notify_listener_test Process.sleep regression
- Update findings.md test coverage gap status
2026-05-29 17:56:03 -05:00

48 lines
1.4 KiB
Elixir

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