from fmatch.saas.operators.assign_global_region import assign_global_region


def test_assign_global_region_normalizes_common_country_synonyms():
    result = assign_global_region("United Kingdom")
    assert result["value"] == "EMEA"
    assert result["meta"]["code"] == "GB"


def test_assign_global_region_handles_lowercase_inputs():
    result = assign_global_region("us")
    assert result["value"] == "NA"
    assert result["meta"]["code"] == "US"


def test_assign_global_region_returns_reason_for_unknown_codes():
    result = assign_global_region("ZZ")
    assert result["value"] == ""
    assert result["meta"]["reason"] == "unknown_code"
