test(backfill): verify pos1/pos2 are derived from grids before status-marking

This commit is contained in:
Graham McIntire 2026-04-20 15:04:21 -05:00
parent 9950aa11c2
commit c78cb977a0
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -682,6 +682,23 @@ defmodule Microwaveprop.Workers.ContactWeatherEnqueueWorkerTest do
assert updated.iemre_status == :queued
end
test "derives pos1/pos2 from grid1/grid2 when missing, then queues path enrichments" do
_station = create_asos_station("KDFW", 32.90, -97.04)
# Historical rows can have grids without lat/lon maps; ensure_positions!/1
# must fill them in before path enrichments get a chance to mark :unavailable.
contact = create_contact(%{pos1: nil, pos2: nil, grid1: "EM12", grid2: "EM00"})
assert is_nil(contact.pos1)
assert is_nil(contact.pos2)
assert :ok = ContactWeatherEnqueueWorker.enqueue_for_contact(contact)
updated = Repo.get!(Contact, contact.id)
assert updated.pos1
assert updated.pos2
assert updated.terrain_status == :queued
assert updated.radar_status == :queued
end
test "works for QSO without pos2 or grid2 (path statuses flip to :unavailable)" do
_station = create_asos_station("KDFW", 32.90, -97.04)
contact = create_contact(%{pos2: nil, grid2: nil})