git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/countries/countries_test.go (about) 1 package countries_test 2 3 import ( 4 "testing" 5 6 "git.sr.ht/~pingoo/stdx/countries" 7 ) 8 9 func TestGetMap(t *testing.T) { 10 expectedNumberOfCountries := 246 11 12 err := countries.Init() 13 if err != nil { 14 t.Error(err) 15 return 16 } 17 countries := countries.GetMap() 18 19 if len(countries) != expectedNumberOfCountries { 20 t.Errorf("Invalid number of countries. Got %d, expected: %d", len(countries), expectedNumberOfCountries) 21 } 22 } 23 24 func TestGetList(t *testing.T) { 25 expectedNumberOfCountries := 246 26 27 err := countries.Init() 28 if err != nil { 29 t.Error(err) 30 return 31 } 32 countries := countries.GetList() 33 34 if len(countries) != expectedNumberOfCountries { 35 t.Errorf("Invalid number of countries. Got %d, expected: %d", len(countries), expectedNumberOfCountries) 36 } 37 }