package award

import (
	"testing"

	"hamlog/internal/qso"
)

// A district lives in CNTY as-is; the US award field keys it to the state
// because county names repeat across states. Confusing the two silently breaks
// whichever award is not American.
func TestCountyFieldIsRawWhileUSCountyIsKeyed(t *testing.T) {
	q := &qso.QSO{State: "TX", County: "RO-19"}
	if got := fieldRaw("county", q); got != "RO-19" {
		t.Fatalf("county = %q, want RO-19", got)
	}
	if got := fieldRaw("us_county", q); got == "RO-19" {
		t.Fatalf("us_county should key the county to its state, got %q", got)
	}
	var found bool
	for _, f := range Fields() {
		if f == "county" {
			found = true
		}
	}
	if !found {
		t.Fatal("county missing from the award field list")
	}
}
