defmodule LambentExWeb.PairingTest do
use LambentExWeb.ConnCase
import Phoenix.LiveViewTest
test "every page carries a pairing qr for the address it is served on", %{conn: conn} do
{:ok, _live, html} = live(conn, "/cfg/devices")
assert html =~ "pair-modal"
# the qr itself, rendered server side
assert html =~ "<svg"
assert html =~ "/socket"
end
test "the qr encodes a reachable base url, never loopback" do
socket = %Phoenix.LiveView.Socket{host_uri: URI.parse("http://localhost:8033")}
urls = LambentExWeb.Layouts.pair_urls(socket)
first = LambentExWeb.Layouts.pair_url(socket)
assert "http://localhost:8033" in urls
refute first =~ "localhost"
assert first =~ ":8033"
end
end
neiam
/lambent_ex
Lambent Aether 5
public · Issues · Pulls 1 · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
741 B · text
History
9c0fc16