prop/test/microwaveprop/radio/qso_test.exs
Graham McIntire 6f16395f44
Add QSO import, solar indices, Oban workers, LiveView UI, and parallel weather import
- Radio context with QSO schema and CSV import script (58K contacts)
- Solar index schema, GFZ client, and daily Oban cron worker
- LiveView dashboard with QSO table and weather correlation views
- Parallelize weather import script using Task.async_stream (10 concurrent workers)
- Replace sequential rate_limit sleeps with concurrency-based backpressure
- Atomic progress counter for interleave-safe reporting
2026-03-29 13:04:55 -05:00

47 lines
1.4 KiB
Elixir

defmodule Microwaveprop.Radio.QsoTest do
use Microwaveprop.DataCase, async: true
alias Microwaveprop.Radio.Qso
@valid_attrs %{
station1: "W1AW",
station2: "K3LR",
qso_timestamp: ~U[2026-03-28 12:00:00Z],
grid1: "FN31pr",
grid2: "EN91jm",
pos1: %{lat: 41.714, lng: -72.727},
pos2: %{lat: 41.049, lng: -80.166},
mode: "SSB",
band: Decimal.new("144.2"),
distance_km: Decimal.new("623.4")
}
describe "changeset/2" do
test "valid attributes" do
changeset = Qso.changeset(%Qso{}, @valid_attrs)
assert changeset.valid?
end
test "requires station1, station2, qso_timestamp, mode, and band" do
changeset = Qso.changeset(%Qso{}, %{})
assert %{
station1: ["can't be blank"],
station2: ["can't be blank"],
qso_timestamp: ["can't be blank"],
mode: ["can't be blank"],
band: ["can't be blank"]
} = errors_on(changeset)
end
test "persists to the database" do
changeset = Qso.changeset(%Qso{}, @valid_attrs)
assert {:ok, qso} = Repo.insert(changeset)
assert qso.station1 == "W1AW"
assert qso.station2 == "K3LR"
assert qso.mode == "SSB"
assert Decimal.equal?(qso.band, Decimal.new("144.2"))
assert Decimal.equal?(qso.distance_km, Decimal.new("623.4"))
end
end
end