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.
27 lines
851 B
Elixir
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
|