towerops/test/towerops_web/plugs/update_session_activity_test.exs
Graham McIntire 03ec909e3a test: add LiveView tests following testing-liveview patterns
Apply Testing LiveView course patterns (live/2, has_element?,
render_click, form/3). Add tests for MobileQRLive, WeathermapLive,
StatusPageLive, controllers, plugs, and pure function modules.
Expand proto decode coverage to 85.24%.
2026-05-07 12:55:39 -05:00

31 lines
799 B
Elixir

defmodule ToweropsWeb.Plugs.UpdateSessionActivityTest do
use ToweropsWeb.ConnCase, async: true
alias ToweropsWeb.Plugs.UpdateSessionActivity
describe "init/1" do
test "passes through opts unchanged" do
assert UpdateSessionActivity.init(:some_opts) == :some_opts
end
end
describe "call/2" do
test "passes through when no user_token in session", %{conn: conn} do
conn =
conn
|> init_test_session(%{})
|> UpdateSessionActivity.call(%{})
assert conn.state == :unset
end
test "starts background task when user_token present", %{conn: conn} do
conn =
conn
|> init_test_session(%{user_token: "existing-token"})
|> UpdateSessionActivity.call(%{})
assert conn.state == :unset
end
end
end