prop/test/microwaveprop_web/live/live_stash_guard_test.exs
Graham McIntire f644d1796f
test: push coverage 79.64% -> 80.04% across multiple modules
New test files: RoverPlanning.Station, LiveStashGuard, RebatchAsos,
RoverMissionReconcileWorker, RoverPathProfileWorker. Extended existing
suites for PathCompute (resolve_location, build_ionosphere_readout),
HrdpsClient (DEPR fallback, missing-level skip), NexradClient
(fetch_rain_cells HTTP error paths), UserHomeQthLookupWorker (error +
Maidenhead-fallback paths), RoverPlanning.Path (statuses/0 + schema).

3512 tests passing.
2026-05-08 08:42:03 -05:00

27 lines
851 B
Elixir

defmodule MicrowavepropWeb.LiveStashGuardTest do
use ExUnit.Case, async: true
alias MicrowavepropWeb.LiveStashGuard
alias Phoenix.LiveView.Socket
describe "stash/1" do
test "swallows ArgumentError when LiveStash hasn't been initialized" do
# An uninitialized socket has no `private.live_stash_adapter`, so
# `LiveStash.stash/1` raises ArgumentError. The guard catches it
# and returns the socket unchanged.
socket = %Socket{}
assert ^socket = LiveStashGuard.stash(socket)
end
test "returns socket unchanged from a fresh struct (no adapter init)" do
socket = %Socket{assigns: %{count: 1}}
result = LiveStashGuard.stash(socket)
# Same socket back — preserves all assigns the LV had set up.
assert result == socket
assert result.assigns.count == 1
end
end
end