package analytics

import "testing"

func TestLookupCountryNameUsesCompleteRegionData(t *testing.T) {
	tests := []struct {
		code string
		want string
	}{
		{code: "KR", want: "South Korea"},
		{code: " eg ", want: "Egypt"},
		{code: "ZA", want: "South Africa"},
		{code: "BR", want: "Brazil"},
	}

	for _, tt := range tests {
		t.Run(tt.code, func(t *testing.T) {
			if got := lookupCountryName(tt.code); got != tt.want {
				t.Fatalf("lookupCountryName(%q) = %q, want %q", tt.code, got, tt.want)
			}
		})
	}
}

func TestLookupCountryNameRejectsInvalidCodes(t *testing.T) {
	for _, code := range []string{"", "AA", "USA", "1"} {
		t.Run(code, func(t *testing.T) {
			if got := lookupCountryName(code); got != "" {
				t.Fatalf("lookupCountryName(%q) = %q, want empty string", code, got)
			}
		})
	}
}
