- Rover.Compute: road/prominence/clearance/clutter/canopy tests (90%) - Rover.Prominence: full unit test suite with mock elev_lookup (100%) - Rover.Elevation: dedup + multi-tile tests (44%) - Rover.LinkMargin: edge cases, negative scores, all modes (57%) - Rover.Location: changeset validation + statuses/0 (100%) - RoverPlanning.Path: changeset validation + statuses/0 (67%) - Pskr.FeatureBin: changeset validation (100%) - Pskr.Mqtt: QoS reject, unknown type, varint overflow, ping/disconnect (97%) - Valkey: not-configured error paths, empty guards (55%) - ScoresController: bad params, time format, missing band tests (81%) - SkewtLive: info/no-profiles state, loading states (29%)
61 lines
1.7 KiB
Elixir
61 lines
1.7 KiB
Elixir
defmodule Microwaveprop.Pskr.FeatureBinTest do
|
|
use Microwaveprop.DataCase, async: true
|
|
|
|
alias Microwaveprop.Pskr.FeatureBin
|
|
|
|
describe "changeset/2" do
|
|
test "valid attrs produce a valid changeset" do
|
|
attrs = %{
|
|
run_id: Ecto.UUID.generate(),
|
|
band: "10000",
|
|
feature: "pwat_mm",
|
|
bin_label: "25-40",
|
|
sample_count: 100
|
|
}
|
|
|
|
changeset = FeatureBin.changeset(%FeatureBin{}, attrs)
|
|
assert changeset.valid?
|
|
end
|
|
|
|
test "missing required fields makes changeset invalid" do
|
|
changeset = FeatureBin.changeset(%FeatureBin{}, %{})
|
|
refute changeset.valid?
|
|
assert "can't be blank" in errors_on(changeset).run_id
|
|
assert "can't be blank" in errors_on(changeset).band
|
|
assert "can't be blank" in errors_on(changeset).feature
|
|
assert "can't be blank" in errors_on(changeset).bin_label
|
|
end
|
|
|
|
test "spot count fields are not required" do
|
|
attrs = %{
|
|
run_id: Ecto.UUID.generate(),
|
|
band: "10000",
|
|
feature: "pwat_mm",
|
|
bin_label: "<15",
|
|
sample_count: 50
|
|
}
|
|
|
|
changeset = FeatureBin.changeset(%FeatureBin{}, attrs)
|
|
assert changeset.valid?
|
|
end
|
|
|
|
test "accepts optional float fields" do
|
|
attrs = %{
|
|
run_id: Ecto.UUID.generate(),
|
|
band: "144",
|
|
feature: "hpbl_m",
|
|
bin_label: "250-500",
|
|
sample_count: 30,
|
|
bin_min: 250.0,
|
|
bin_max: 500.0,
|
|
spot_count_avg: 3.5,
|
|
spot_count_p50: 3.0,
|
|
spot_count_p90: 8.0
|
|
}
|
|
|
|
changeset = FeatureBin.changeset(%FeatureBin{}, attrs)
|
|
assert changeset.valid?
|
|
assert get_change(changeset, :bin_min) == 250.0
|
|
end
|
|
end
|
|
end
|