Backend: Add tests to internal/entity
This commit is contained in:
parent
238468c8f9
commit
4aaa4e9fc2
2 changed files with 14 additions and 6 deletions
|
@ -22,7 +22,7 @@ func (m PlacesMap) Pointer(name string) *Place {
|
|||
|
||||
var PlaceFixtures = PlacesMap{
|
||||
"teotihuacan": {
|
||||
ID: "85d1ea7d382c",
|
||||
ID: "85d1ea7d3278",
|
||||
LocLabel: "Teotihuacán, Mexico, Mexico",
|
||||
LocCity: "Teotihuacán",
|
||||
LocState: "Mexico",
|
||||
|
@ -35,7 +35,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"zinkwazi": {
|
||||
ID: "1ef744d1e28c",
|
||||
ID: "1ef744d1e279",
|
||||
LocLabel: "KwaDukuza, KwaZulu-Natal, South Africa",
|
||||
LocCity: "KwaDukuza",
|
||||
LocState: "KwaZulu-Natal",
|
||||
|
@ -62,7 +62,7 @@ var PlaceFixtures = PlacesMap{
|
|||
},
|
||||
"emptyNameLongCity": {
|
||||
ID: "1ef744d1e281",
|
||||
LocLabel: "",
|
||||
LocLabel: "label",
|
||||
LocCity: "longlonglonglonglongcity",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
LocCountry: "de",
|
||||
|
@ -75,7 +75,7 @@ var PlaceFixtures = PlacesMap{
|
|||
},
|
||||
"emptyNameShortCity": {
|
||||
ID: "1ef744d1e282",
|
||||
LocLabel: "",
|
||||
LocLabel: "label",
|
||||
LocCity: "shortcity",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
LocCountry: "de",
|
||||
|
@ -88,7 +88,7 @@ var PlaceFixtures = PlacesMap{
|
|||
},
|
||||
"veryLongLocName": {
|
||||
ID: "1ef744d1e283",
|
||||
LocLabel: "",
|
||||
LocLabel: "label",
|
||||
LocCity: "Mainz",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
LocCountry: "de",
|
||||
|
@ -101,7 +101,7 @@ var PlaceFixtures = PlacesMap{
|
|||
},
|
||||
"mediumLongLocName": {
|
||||
ID: "1ef744d1e284",
|
||||
LocLabel: "",
|
||||
LocLabel: "label",
|
||||
LocCity: "New york",
|
||||
LocState: "New york",
|
||||
LocCountry: "us",
|
||||
|
|
|
@ -22,6 +22,14 @@ func TestFindPlaceByLabel(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "de", r.LocCountry)
|
||||
})
|
||||
t.Run("find by id", func(t *testing.T) {
|
||||
r := FindPlaceByLabel("85d1ea7d3278", "")
|
||||
|
||||
if r == nil {
|
||||
t.Fatal("result should not be nil")
|
||||
}
|
||||
assert.Equal(t, "mx", r.LocCountry)
|
||||
})
|
||||
t.Run("find by label", func(t *testing.T) {
|
||||
r := FindPlaceByLabel("", "KwaDukuza, KwaZulu-Natal, South Africa")
|
||||
|
||||
|
|
Loading…
Reference in a new issue