test: InfoLive.Show renders with seeded device identifier
This commit is contained in:
parent
093713f042
commit
25804a6f7f
1 changed files with 35 additions and 0 deletions
|
|
@ -256,6 +256,41 @@ defmodule AprsmeWeb.InfoLive.ShowFullRenderTest do
|
||||||
assert html =~ "Some comment text"
|
assert html =~ "Some comment text"
|
||||||
end
|
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
|
test "renders a packet with an object_name", %{conn: conn} do
|
||||||
_packet =
|
_packet =
|
||||||
packet_fixture(%{
|
packet_fixture(%{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue