test: InfoLive.Show renders with seeded device identifier

This commit is contained in:
Graham McIntire 2026-04-24 08:20:03 -05:00
parent 093713f042
commit 25804a6f7f
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -256,6 +256,41 @@ defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do
assert html =~ "Some comment text"
end
test "renders with a device identifier that matches a seeded device", %{conn: conn} do
# Seed a device that enrich_with_device_info can find
Aprsme.Repo.delete_all(Aprsme.Devices)
Aprsme.Repo.insert!(%Aprsme.Devices{
identifier: "APTESTX",
vendor: "TestVendor",
model: "TestModel",
contact: "test@example.com",
class: "Tracker"
})
devices = Aprsme.Repo.all(Aprsme.Devices)
Aprsme.Cache.put(:device_cache, :all_devices, devices)
_packet =
packet_fixture(%{
sender: "WITHDEV",
base_callsign: "WITHDEV",
ssid: "0",
destination: "APTESTX",
device_identifier: "APTESTX",
received_at: DateTime.utc_now(),
lat: Decimal.new("33.0"),
lon: Decimal.new("-96.5"),
has_position: true,
path: "WIDE1-1"
})
{:ok, _lv, html} = live(conn, ~p"/info/WITHDEV", on_error: :warn)
# The device enrichment should add vendor/model to the rendered page.
assert html =~ "WITHDEV"
end
test "renders a packet with an object_name", %{conn: conn} do
_packet =
packet_fixture(%{