From c78cb977a0f98fbe750b4396b63b1900304b7c45 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 20 Apr 2026 15:04:21 -0500 Subject: [PATCH] test(backfill): verify pos1/pos2 are derived from grids before status-marking --- .../contact_weather_enqueue_worker_test.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/microwaveprop/workers/contact_weather_enqueue_worker_test.exs b/test/microwaveprop/workers/contact_weather_enqueue_worker_test.exs index c82d882b..d74e8a10 100644 --- a/test/microwaveprop/workers/contact_weather_enqueue_worker_test.exs +++ b/test/microwaveprop/workers/contact_weather_enqueue_worker_test.exs @@ -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})