Code clean-up
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
e129fab926
commit
528f80de3b
5 changed files with 22 additions and 22 deletions
|
@ -26,7 +26,7 @@ func (m LocationMap) Pointer(name string) *Location {
|
|||
|
||||
var LocationFixtures = LocationMap{
|
||||
"mexico": {
|
||||
ID: s2.TokenPrefix+"85d1ea7d382c",
|
||||
ID: s2.TokenPrefix + "85d1ea7d382c",
|
||||
PlaceID: PlaceFixtures.Get("mexico").ID,
|
||||
LocName: "Adosada Platform",
|
||||
LocCategory: "botanical garden",
|
||||
|
@ -36,10 +36,10 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"caravan park": {
|
||||
ID: s2.TokenPrefix+"1ef75a71a36c",
|
||||
PlaceID: s2.TokenPrefix+"1ef75a71a36c",
|
||||
ID: s2.TokenPrefix + "1ef75a71a36c",
|
||||
PlaceID: s2.TokenPrefix + "1ef75a71a36c",
|
||||
Place: &Place{
|
||||
ID: "x1ef75a71a36",
|
||||
ID: s2.TokenPrefix + "1ef75a71a36",
|
||||
LocLabel: "Mandeni, KwaZulu-Natal, South Africa",
|
||||
LocCity: "Mandeni",
|
||||
LocState: "KwaZulu-Natal",
|
||||
|
@ -54,7 +54,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"zinkwazi": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e28c",
|
||||
ID: s2.TokenPrefix + "1ef744d1e28c",
|
||||
PlaceID: PlaceFixtures.Get("zinkwazi").ID,
|
||||
Place: PlaceFixtures.Pointer("zinkwazi"),
|
||||
LocName: "Zinkwazi Beach",
|
||||
|
@ -64,7 +64,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"hassloch": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e280",
|
||||
ID: s2.TokenPrefix + "1ef744d1e280",
|
||||
PlaceID: PlaceFixtures.Get("holidaypark").ID,
|
||||
Place: PlaceFixtures.Pointer("holidaypark"),
|
||||
LocName: "Holiday Park",
|
||||
|
@ -74,7 +74,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"emptyNameLongCity": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e281",
|
||||
ID: s2.TokenPrefix + "1ef744d1e281",
|
||||
PlaceID: PlaceFixtures.Get("emptyNameLongCity").ID,
|
||||
Place: PlaceFixtures.Pointer("emptyNameLongCity"),
|
||||
LocName: "",
|
||||
|
@ -84,7 +84,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"emptyNameShortCity": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e282",
|
||||
ID: s2.TokenPrefix + "1ef744d1e282",
|
||||
PlaceID: PlaceFixtures.Get("emptyNameShortCity").ID,
|
||||
Place: PlaceFixtures.Pointer("emptyNameShortCity"),
|
||||
LocName: "",
|
||||
|
@ -94,7 +94,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"veryLongLocName": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e283",
|
||||
ID: s2.TokenPrefix + "1ef744d1e283",
|
||||
PlaceID: PlaceFixtures.Get("veryLongLocName").ID,
|
||||
Place: PlaceFixtures.Pointer("veryLongLocName"),
|
||||
LocName: "longlonglonglonglonglonglonglonglonglonglonglonglongName",
|
||||
|
@ -104,7 +104,7 @@ var LocationFixtures = LocationMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"mediumLongLocName": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e283",
|
||||
ID: s2.TokenPrefix + "1ef744d1e283",
|
||||
PlaceID: PlaceFixtures.Get("mediumLongLocName").ID,
|
||||
Place: PlaceFixtures.Pointer("mediumLongLocName"),
|
||||
LocName: "longlonglonglonglonglongName",
|
||||
|
|
|
@ -26,7 +26,7 @@ func (m PlacesMap) Pointer(name string) *Place {
|
|||
|
||||
var PlaceFixtures = PlacesMap{
|
||||
"mexico": {
|
||||
ID: s2.TokenPrefix+"85d1ea7d3278",
|
||||
ID: s2.TokenPrefix + "85d1ea7d3278",
|
||||
LocLabel: "Teotihuacán, Mexico, Mexico",
|
||||
LocCity: "Teotihuacán",
|
||||
LocState: "State of Mexico",
|
||||
|
@ -39,7 +39,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"zinkwazi": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e279",
|
||||
ID: s2.TokenPrefix + "1ef744d1e279",
|
||||
LocLabel: "KwaDukuza, KwaZulu-Natal, South Africa",
|
||||
LocCity: "KwaDukuza",
|
||||
LocState: "KwaZulu-Natal",
|
||||
|
@ -52,7 +52,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"holidaypark": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e280",
|
||||
ID: s2.TokenPrefix + "1ef744d1e280",
|
||||
LocLabel: "Holiday Park, Amusement",
|
||||
LocCity: "",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
|
@ -65,7 +65,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"emptyNameLongCity": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e281",
|
||||
ID: s2.TokenPrefix + "1ef744d1e281",
|
||||
LocLabel: "labelEmptyNameLongCity",
|
||||
LocCity: "longlonglonglonglongcity",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
|
@ -78,7 +78,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"emptyNameShortCity": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e282",
|
||||
ID: s2.TokenPrefix + "1ef744d1e282",
|
||||
LocLabel: "labelEmptyNameShortCity",
|
||||
LocCity: "shortcity",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
|
@ -91,7 +91,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"veryLongLocName": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e283",
|
||||
ID: s2.TokenPrefix + "1ef744d1e283",
|
||||
LocLabel: "labelVeryLongLocName",
|
||||
LocCity: "Mainz",
|
||||
LocState: "Rheinland-Pfalz",
|
||||
|
@ -104,7 +104,7 @@ var PlaceFixtures = PlacesMap{
|
|||
UpdatedAt: time.Now(),
|
||||
},
|
||||
"mediumLongLocName": {
|
||||
ID: s2.TokenPrefix+"1ef744d1e284",
|
||||
ID: s2.TokenPrefix + "1ef744d1e284",
|
||||
LocLabel: "labelMediumLongLocName",
|
||||
LocCity: "New york",
|
||||
LocState: "New york",
|
||||
|
|
|
@ -58,7 +58,7 @@ func TestPlace_Find(t *testing.T) {
|
|||
})
|
||||
t.Run("record does not exist", func(t *testing.T) {
|
||||
place := &Place{
|
||||
ID: s2.TokenPrefix+"1110",
|
||||
ID: s2.TokenPrefix + "1110",
|
||||
LocLabel: "test",
|
||||
LocCity: "testCity",
|
||||
LocState: "",
|
||||
|
|
|
@ -28,7 +28,7 @@ func Prefix(token string) string {
|
|||
return token
|
||||
}
|
||||
|
||||
return TokenPrefix+token
|
||||
return TokenPrefix + token
|
||||
}
|
||||
|
||||
// PrefixedToken returns the prefixed S2 cell token for coordinates using the default level.
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func TestNormalizeToken(t *testing.T) {
|
||||
t.Run(TokenPrefix+"1242342bac", func(t *testing.T) {
|
||||
input := TokenPrefix+"1242342bac"
|
||||
input := TokenPrefix + "1242342bac"
|
||||
|
||||
output := NormalizeToken(input)
|
||||
|
||||
|
@ -29,7 +29,7 @@ func TestNormalizeToken(t *testing.T) {
|
|||
|
||||
func TestPrefix(t *testing.T) {
|
||||
t.Run(TokenPrefix+"1242342bac", func(t *testing.T) {
|
||||
input := TokenPrefix+"1242342bac"
|
||||
input := TokenPrefix + "1242342bac"
|
||||
|
||||
output := Prefix(input)
|
||||
|
||||
|
@ -57,7 +57,7 @@ func TestPrefix(t *testing.T) {
|
|||
func TestPrefixedToken(t *testing.T) {
|
||||
t.Run("germany", func(t *testing.T) {
|
||||
token := PrefixedToken(48.56344833333333, 8.996878333333333)
|
||||
expected := TokenPrefix+"4799e370"
|
||||
expected := TokenPrefix + "4799e370"
|
||||
|
||||
assert.True(t, strings.HasPrefix(token, expected))
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue