816 B · text History 9c0fc16
defmodule LambentExWeb.DevicesTest do
  use LambentExWeb.ConnCase

  import Phoenix.LiveViewTest

  test "a multi-channel tasmota is listed rather than taking the page down", %{conn: conn} do
    {:ok, live, _html} = live(conn, "/cfg/devices")

    # trimmed from what a three channel tasmota reports: POWER1..3, no POWER
    send(
      live.pid,
      {:devices_pub,
       %{
         "tasmota_F10E32" => %{
           "Channel1" => 0,
           "Color" => "02FF80",
           "POWER1" => "OFF",
           "POWER2" => "ON",
           "POWER3" => "OFF",
           "dname" => "default",
           "name" => nil,
           "place" => nil,
           "type" => "mqtt-tasmota"
         }
       }}
    )

    html = render(live)
    assert html =~ "tasmota_F10E32"
    assert html =~ "MQTT (default)"
  end
end