defmodule ChesstrainerWeb.SitemapControllerTest do use ChesstrainerWeb.ConnCase, async: true alias ChesstrainerWeb.Endpoint describe "GET /sitemap.xml" do test "lists only the public marketing pages", %{conn: conn} do body = conn |> get(~p"/sitemap.xml") |> response(200) base_url = Endpoint.url() assert body =~ ~s() assert body =~ ~s() assert body =~ "#{base_url}/" assert body =~ "#{base_url}/privacy" assert body =~ "#{base_url}/terms-conditions" assert length(:binary.matches(body, "")) == 3 end test "is served as XML", %{conn: conn} do conn = get(conn, ~p"/sitemap.xml") assert [content_type] = get_resp_header(conn, "content-type") assert content_type =~ "application/xml" end end end