prop/test/microwaveprop_web/live/api_docs_live_test.exs
Graham McIntire 0429c9dbab
fix(docs): render API reference bullets correctly + tighter reading column
Two issues made docs/api hard to read:

1. The site's custom Markdown parser only recognized `- ` bullets,
   so the README's `* ` bullets rendered as a single run-on paragraph
   with literal asterisks. Extended the parser (and tests) to accept
   the full CommonMark bullet set: `-`, `*`, `+`.

2. The shared .markdown-content container is 88rem wide. Comfortable
   for /algo's wide tables but uncomfortable for monospace prose,
   which prefers ~80ch. Added a .api-docs modifier class on the
   /docs/api page that drops max-width to 60rem, allows table
   cells to wrap, and slightly downsizes headings.
2026-05-09 09:46:45 -05:00

26 lines
809 B
Elixir

defmodule MicrowavepropWeb.ApiDocsLiveTest do
use MicrowavepropWeb.ConnCase, async: true
import Phoenix.LiveViewTest
test "renders the API reference at /docs/api", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/docs/api")
assert html =~ "Microwaveprop REST API"
assert html =~ "/api/v1"
assert html =~ "POST /auth/tokens"
end
test "renders bulleted lists rather than literal asterisks", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/docs/api")
assert html =~ "<ul>"
assert html =~ "<li>"
refute html =~ ~r/<p>\*\s+<strong>Base URL/
end
test "applies the .api-docs class so the page has a sane reading width", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/docs/api")
assert html =~ ~s(class="markdown-content api-docs")
end
end