package main import ( "testing" "hamlog/internal/qso" ) // A Confirmations default of "R" means "I intend to upload this", not "it has // gone" — reading it as sent would silently disable the auto-upload the default // was set to arm. Only a real stamp blocks. func TestExtrasSaysSent(t *testing.T) { pending := []string{"", " ", "R", "r", "N", "Q", "I"} for _, v := range pending { if extrasSaysSent(v) { t.Errorf("extrasSaysSent(%q) = true, want false (still to upload)", v) } } sent := []string{"Y", "y", "20260831"} // "Y" today, a date in older builds for _, v := range sent { if !extrasSaysSent(v) { t.Errorf("extrasSaysSent(%q) = false, want true (already uploaded)", v) } } } // The HamQTH default lands on the extras key the uploader reads, and must leave // the QSO eligible. func TestHamQTHDefaultStaysUploadable(t *testing.T) { q := &qso.QSO{Callsign: "F4BPO"} applyQSLDefaultsTo(q, defaultQSLDefaults()) if got := q.Extras[hamqthSentKey]; got != "R" { t.Fatalf("HamQTH sent extra = %q, want %q", got, "R") } if extrasSaysSent(q.Extras[hamqthSentKey]) { t.Error("a freshly logged QSO reads as already uploaded to HamQTH") } }